-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Interpret strings in excluded
option of *_name
rules as regular expressions
#4655
Conversation
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of supporting patterns for excluded names. However, the NameConfiguration
already contains a few options and I would like to avoid adding a new one. The existing list of excluded
names would only become a subset of the new excluded_pattern
option.
What do you think about just interpreting the strings in the excluded
list as regular expression that must match a whole name? If there is a list element "MyName"
it would only match the name MyName
but not MyName_v1
. That makes sure that existing configurations work as before. With the possibility to add regular expressions to the list, one could add "^MyName_v\d+$"
to match the other (versioned) name, too.
Furthermore, NameConfiguration
is also used in GenericTypeNameRule
and TypeNameRule
. This should be tested as well.
bebc2c5
to
7bb5405
Compare
eb79c29
to
ac8f38f
Compare
ac8f38f
to
399a972
Compare
c71d652
to
4a67760
Compare
Well done! Thank you for all the work and your patience. |
excluded_regular_expressions
option for identifier_name ruleexcluded
option of *_name
rules as regular expressions
There already exists an option called
excluded
to prevent some unwanted checks.However,
excluded
option has limitations when we need to exclude names with similar patterns since it requires exact match.So we may solve this problem by adding
excluded_regular_expressions
option toidentifier_name
rule and exclude some names by regex.This would be extremely helpful in situations like below: