Skip to content

diff-coverage: ignore counts inside a string or comment prose, unlike mutant: equivalent #33

Backlog

Description

@vlsi

A line whose only diff-coverage: ignore sits in a string literal, or after a * in the prose of a comment, leaves the diff-coverage report as acknowledged. For example, both of these lines drop out of the uncovered list:

String hint = "// diff-coverage: ignore -- why";
x(); y(); // a * diff-coverage: ignore here

DiffCoverageReport.IGNORE_MARKER matches (?://|/\*|\*)\s*diff-coverage:\s*ignore on the raw text of the line, and its Javadoc states that a marker inside a string counts as well (DiffCoverageReport.java:36-41). #31 reads mutant: equivalent markers by different rules: one counts only where a // or /* opens a comment or lies in a line comment, or where a run of * leads a line inside a block comment, as SourceFileKey.tokens lexes the file. So the two markers disagree on the same line.

Expected: one rule for both markers. Applying the #31 rule to diff-coverage: ignore changes the shipped behavior of an existing marker, since a line acknowledged only by a marker in a string would count as uncovered again. The decision this needs is whether that change is wanted, and in which release.

Related: #32 (whether diff-coverage: ignore should also cover the mutants of its line).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions