You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Ruby in the domain of 3D modelling. So common short variables include x, y, z and u, v. These are flagged by the default rules of Naming/UncommunicativeMethodParamName so I add them to the list of allowed names:
Naming/UncommunicativeMethodParamName:
AllowedNames:
- x
- y
- z
- u
- v
- uv
However, some times these names are also used as argument names in callbacks of the API. And you don't always use all the arguments being passed in the callback. For instance:
However this then will again flag the x and y arguments:
src/tt_truebend/tools/truebend.rb:195:42: C: Naming/UncommunicativeMethodParamName: Method parameter must be at least 3 characters long.
def onLButtonDoubleClick(_flags, _x, _y, _view)
I could add _x and _y to the list of allowed names. But this still feels like a bug - where the cop should take into account the convention of using underscore prefix to denote unused arguments.
Expected behavior
I would expect Naming/UncommunicativeMethodParamName to take into account the _ prefix convention and strip it away when it checks against the list of allowed short names.
Actual behavior
Currently _x is flagged even if x is an allowed variable name.
Steps to reproduce the problem
Naming/UncommunicativeMethodParamName:
AllowedNames:
- x
- y
- z
I use Ruby in the domain of 3D modelling. So common short variables include
x
,y
,z
andu
,v
. These are flagged by the default rules ofNaming/UncommunicativeMethodParamName
so I add them to the list of allowed names:However, some times these names are also used as argument names in callbacks of the API. And you don't always use all the arguments being passed in the callback. For instance:
However this then will again flag the
x
andy
arguments:I could add
_x
and_y
to the list of allowed names. But this still feels like a bug - where the cop should take into account the convention of using underscore prefix to denote unused arguments.Expected behavior
I would expect
Naming/UncommunicativeMethodParamName
to take into account the_
prefix convention and strip it away when it checks against the list of allowed short names.Actual behavior
Currently
_x
is flagged even ifx
is an allowed variable name.Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: