You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a Parameter to commas_linter to Allow Comma Followed by Closing Bracket Without Space #2102
Currently, the commas_linter marks an expression like x[1,] as incorrect, expecting a space after the comma. This is because the default behavior enforces a space after each comma in an expression. However, there is a common convention, where a comma followed directly by a closing bracket does not necessitate a space. This writing style is even utilized in the official base R documentation, specifically in the matrix section.
To cater to this, I propose adding a new parameter to the commas_linter function which allows users to specify whether a comma followed immediately by a closing bracket should be marked as incorrect or not. For instance:
commas_linter(allow_trailing_comma = TRUE)
When allow_trailing_comma is set to TRUE, commas_linter would not mark x[1,] as incorrect.
Activity
AshesITR commentedon Sep 4, 2023
Nice idea. Noting the the default should be
FALSE, though, since we try to line up our defaults with the tidyverse styleguide.https://style.tidyverse.org/syntax.html#commas
A PR is welcome if you'd like to give it a try.