Skip to content

Investigate preceding-sibling::* misuse more broadly #2405

Closed
@MichaelChirico

Description

@MichaelChirico

#2402 exposed an issue about preceding-sibling::*[1] including COMMENT by mistake. Took a quick look for similar such bugs and immediately found one in keyword_quote_linter():

lint("a$ # comment\n'b'", keyword_quote_linter())
# <text>:2:1: warning: [keyword_quote_linter] Only quote targets of extraction with # comment if necessary, i.e., if the name is not a valid R symbol (see ?make.names). Use backticks to create non-syntactic names, or use slot() to extract by string.
# 'b'
# ^~~

# comment in the lint message is supposed to be $.

Filing this issue to fix this and other such instances throughout the codebase. Since they've gone unnoticed thus far, they're mainly about cases where comments go in "unusual" places, but it can't hurt to be more robust.

Metadata

Metadata

Assignees

No one assigned

    Labels

    consistency 🍎 🍏internalsIssues related to inner workings of lintr, i.e., not user-visible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions