Closed
Description
Hello!
We use:
rubocop -V
0.85.0 (using Parser 2.7.1.3, rubocop-ast 0.0.3, running on ruby 2.4.5 x86_64-darwin18)
We have problem with cop
Naming/MethodName:
EnforcedStyle: camelCase
and '_' or 'i' variables.
We have offences like that:
C: Naming/VariableName: Use camelCase for variable names. (https://rubystyle.guide#snake-case-symbols-methods-vars)
readM.select { |_, opt| opt[:name] == dTypeName }.first
^
For fixing that line needs to be changed:
https://github.com/rubocop-hq/rubocop/blob/971769a0a01c55d9b23a29ae8d5b3ab45f637152/lib/rubocop/cop/mixin/configurable_naming.rb#L12
From
camelCase: /^@{0,2}_?[a-z][\da-zA-Z]+[!?=]?$/
To:
camelCase: /^@{0,2}_?([a-z]|[a-z][\da-zA-Z]+)?[!?=]?$/
I can create pull request if acceptable
Activity
marcandre commentedon Jun 10, 2020
Good catch. A pull request would be great. Best use a no-capture
(?: ... )
I think.avrusanov commentedon Jun 10, 2020
/^@{0,2}_?(?:[a-z]|[a-z][\da-zA-Z]+)?[!?=]?$/ - OK?
marcandre commentedon Jun 10, 2020
[a-z]|[a-z][\da-zA-Z]+
=>[a-z][\da-zA-Z]*
, simpler and equivalent, right?avrusanov commentedon Jun 11, 2020
Yes.
/^@{0,2}(?:_|_?[a-z][\da-zA-Z]*)[!?=]?$/
is acceptable?[Fix rubocop#8132] Fix the problem with Naming/MethodName: EnforcedSt…
[Fix rubocop#8132] Restore the blank line in CHANGELOG.md
[Fix rubocop#8132] Fix the problem with Naming/MethodName: EnforcedSt…