Skip to content

equals_na_linter finds lints within comments #545

@MichaelChirico

Description

@MichaelChirico
expect_lint("# x == NA", NULL, equals_na_linter)
#Error: got 1 lints instead of 0
# list(filename = "/tmp/RtmpISkLn0/file28f330767e742d", line_number = 1, column_number = 5, type = "warning", message = "Use is.na rather than == NA.", line = "# x == NA", ranges = list(c(5, 9)), linter = "equals_na_linter")

In fact it doesn't even need to be in a comment:

expect_lint("' x == NA'", NULL, equals_na_linter)
#Error: got 1 lints instead of 0
# list(filename = "/tmp/RtmpISkLn0/file28f330767e742d", line_number = 1, column_number = 5, type = "warning", message = "Use is.na rather than == NA.", line = "' x == NA'", ranges = list(c(5, 9)), linter = "equals_na_linter")

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