-
Notifications
You must be signed in to change notification settings - Fork 195
Closed
Description
Hi,
I have written a new linter, called object_name_linter, which includes the features of the existing name
linters (camel_case_linter, snake_case_linter and mutiple_dots_linter) and adds new ones.
Features of object_name_linter:
- A single linter is needed to check for naming style (instead of several currently). Just specify the style to use and all others will be linted (including unrecognized styles, e.g. in a name like "my_inconsistentStyle").
- Possibility to enforce new styles: "alllowercase" and "UPPERCASE".
- The camelcase style is split into "UpperCamelCase" and "lowerCamelCase"
- The linters are digit-aware, i.e. digits count as both lowercase or uppercase and a name such as "html5Parser" is thus valid "lowerCamelCase" (in contrast with
camel_case_linter). - Style checking is turned off for names from functions that seem to extend known generics (even
those that contain mutiple dots such asas.data.frame.data.frame), and this without having to load
or require any packages. - Private objects (with a name starting with one or multiple dots) are supported. Thus, ".my_var" is
valid "snake_case". - Quoted functions and operators are properly handled, i.e. backticks are removed and operators like
%in%are not subjected to a style check. - Only newly-defined object are submitted to style checking. This prevents imported functions (and other objects) to trigger lints.
This work partially derives from discussions at:
#108
#182
#183
#191
In my opinion, object_name_linter could effectively replace the existing name linters.
Best,
Florent
PS/ Not having the ability to contribute code directly through Github, I am attaching my code and unit tests here: object_name_linter.zip
jrnold
Metadata
Metadata
Assignees
Labels
No labels