Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brace_linter exception opening exception should apply for preceding comma-then-comment, too #1433

Closed
MichaelChirico opened this issue Jun 28, 2022 · 1 comment · Fixed by #1451
Assignees
Labels
false-positive code that shouldn't lint, but does

Comments

@MichaelChirico
Copy link
Collaborator

Compare:

lintr::lint('
test_that(
  "Some longer test description",
  {
    # Do test stuff
  }
)',
lintr::brace_linter())

vs

lintr::lint('
test_that(
  "Some longer test description", # comment
  {
    # Do test stuff
  }
)',
lintr::brace_linter())
# <text>:4:3: style: [brace_linter] Opening curly braces should never go on their own line and should always be followed by a new line.
#   {
#   ^

The exception should apply to the latter case as well

@IndrajeetPatil
Copy link
Collaborator

With #1451:

lintr::lint('
test_that(
  "Some longer test description", # comment
  {
    # Do test stuff
  }
)',
lintr::brace_linter())

Created on 2022-07-16 by the reprex package (v2.0.1)

@MichaelChirico MichaelChirico added this to the 3.0.1 milestone Jul 25, 2022
@IndrajeetPatil IndrajeetPatil self-assigned this Jul 26, 2022
MichaelChirico added a commit that referenced this issue Jul 28, 2022
* Comment on preceding line fine w/ `brace_linter()`

Closes #1433
Closes #1434

* Update NEWS.md

* add comment about native pipe

* remove lints

* add a failing test for regression

* start with suggested

* any prior line, not just exactly one prior

* tweak NEWS

Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
@MichaelChirico MichaelChirico modified the milestones: 3.0.3, 3.1.0 Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-positive code that shouldn't lint, but does
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants