Skip to content

Add SNAKE_CASE style option - #494

Merged
russHyde merged 4 commits into
r-lib:masterfrom
AshesITR:patch-1
May 15, 2020
Merged

russHyde merged 4 commits into
r-lib:masterfrom
AshesITR:patch-1

Conversation

@AshesITR

Copy link
Copy Markdown
Collaborator

I like to write variables in snake_case except when they are CONSTANTS.
To prevent the object_name_linter from complaining, I would like to allow (uppercase) "SNAKE_CASE" as an option.

I like to write variables in snake_case except when they are CONSTANTS.
To prevent the `object_name_linter` from complaining, I would like to allow (uppercase) "SNAKE_CASE" as an option.
@AshesITR
AshesITR requested a review from jimhester as a code owner May 15, 2020 08:57
@russHyde

russHyde commented May 15, 2020 •

Copy link
Copy Markdown
Collaborator

Could you add several tests to ensure this works as anticipated and remake the docs to ensure SNAKE_CASE is added to the help page for object_name_linter.

It looks like the regex will match "MY_var" but not "DONT_MUTATE_MY_BIG_TABLE" at present.

@AshesITR

Copy link
Copy Markdown
Collaborator Author

Thanks, will do once I have access to a RStudio instance.

@AshesITR

AshesITR commented May 15, 2020 •

Copy link
Copy Markdown
Collaborator Author

@russHyde It appears that man/ is .gitignored, but locally the docs got updated to include

A subset of ‘CamelCase’, ‘camelCase’, ‘snake_case’, ‘SNAKE_CASE’, ‘dotted.case’, ‘lowercase’, ‘UPPERCASE’. A name should match at least one of these styles.

I had to manually delete man/linters.Rd, though. Roxygen didn't automatically detect the change.

@russHyde

Copy link
Copy Markdown
Collaborator

That's funny. I can't see man/ in the .gitignore for lintr.

@AshesITR

Copy link
Copy Markdown
Collaborator Author

Ah, the .Rd files are actually the same:

\item{styles}{A subset of
\Sexpr[stage=render, results=rd]{lintr:::regexes_rd}. A name should
match at least one of these styles.}

Anything else needs updating?

@russHyde

Copy link
Copy Markdown
Collaborator

lgtm. recommend merging if that's okay with you @jimhester .

@jimhester

Copy link
Copy Markdown
Member

Merge away! Also feel free to merge other PRs in the future without needing to ping me unless you need an extra set of eyes

@russHyde
russHyde merged commit 3a7ec5c into r-lib:master May 15, 2020
@russHyde

Copy link
Copy Markdown
Collaborator

Thanks @AshesITR .

@AshesITR
AshesITR deleted the patch-1 branch November 1, 2020 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants