-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
normalcase for VariableNumber doesn't allow foo_bar1
?
#3516
Comments
It also thinks
|
Yeah @jaredbeck see #3514 for that issue |
|
Having the same problem with variables ending in |
I believe the rule should only apply to how the number is appended to its preceeding text. So for normalcase: user1_id # valid
user_1_id # invalid
sha256 # valid
sha_256 #invalid for snake_case: user1_id # invalid
user_1_id # valid
sha256 # invalid
sha_256 #valid Even though, I believe that The problem is, that the cop only "wants" to address counting (user 1, user 2, etc), but it matches anything that contains a number.... |
…sion and relevant tests.
It is currently bugged: * rubocop/rubocop#3514 * rubocop/rubocop#3516 * rubocop/rubocop#3519
…fines normal case by allowing numbers after the first underscore.
It is currently bugged: * rubocop/rubocop#3514 * rubocop/rubocop#3516 * rubocop/rubocop#3519
* bbatsov/master: (80 commits) [Fix rubocop#3540] Make `Style/GuardClause` register offense for instance & singleton methods [Fix rubocop#3436] issue related to Rails/SaveBang when returning non-bang call from the parent method Allow `#to_yml` to produce single-quoted strings Add support for StyleGuideBaseURL and update rules Add spec for the existing style guide URL implementation Fix the changelog Edited regular expression for normal case to fix issues rubocop#3514 and rubocop#3516 (rubocop#3524) Add a rake task for generation a new cop (rubocop#3533) [Fix rubocop#3510] Various bug fixes for SafeNavigation (rubocop#3517) [Fix rubocop#3512] Change error message of `Lint/UnneededSplatExpansion` for array (rubocop#3526) Fix false positive in `Lint/AssignmentInCondition` (rubocop#3520) (rubocop#3529) Rename a mismatched filename (rubocop#3523) Fix a broken changelog entry [Fix rubocop#3511] Style/TernaryParentheses false positive (rubocop#3513) Fix the release notes for 0.43 Cut 0.43.0 [Fix rubocop#3462] Don't flag single-line methods Fix false negatives in `Rails/NotNullColumn` cop (rubocop#3508) Remove unused doubled methods (rubocop#3509) [Fix rubocop#3485] Make OneLineConditional cop ignore empty else (rubocop#3487) ...
…and rubocop#3516 (rubocop#3524) [Fix rubocop#3514][Fix rubocop#3516] Edit regular expression which defines normal case by allowing numbers after the first underscore. This also fixes the normal case analog to issue rubocop#3519 - changed and simplified normal case definition to allow multi-digit numbers.
Rubocop has raised this error, renaming, so that `_` is not added in front of the digit if last symbol before it is a letter. See rubocop/rubocop#3516
Rubocop has raised this error, renaming, so that `_` is not added in front of the digit. See rubocop/rubocop#3516
The new
VariableNumber
cop flags variables likeuser_name_1
when the enforced style isnormalcase
. I would imagine thatuser_name1
would be make the style check pass but this isn't valid either apparently. The only thing I can do to get this to pass withnormalcase
isuserName1
which is odd.Expected behavior
Actual behavior
Steps to reproduce the problem
Run the
VariableNumber
cop against any source file with a variable name which contains an underscore between two words and a trailing number (likefoo_bar1
).RuboCop version
Include the output of
rubocop -V
. Here's an example:The text was updated successfully, but these errors were encountered: