-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
I just upgraded to the latest rubocop and received some peculiar offenses from Style/AccessModifierDeclarations offenses. I use a number of different tools that generate methods automatically, including anima
, for example. But sometimes I apply a different access modifier to the generated method(s). Style/AccessModifierDeclarations flags this as "inlined", when it is not anything I would consider inline.
Expected behavior
I expect the following example (and various similar cases) not to raise an offense with the default rubocop configuration.
class Foo
include Anima.new(:foo) # Defines constructor which takes the single keyword argument :foo and generates a public reader.
private :foo
end
If, for some reason, this is the intended behavior and I'm missing something here, I think the error message should be made clearer. I think this cop should ignore access modifier adjustments to methods it can't statically detect.
Actual behavior
test.rb:4:3: C: Style/AccessModifierDeclarations: private should not be inlined in method definitions.
private :foo
^^^^^^^
Steps to reproduce the problem
Run rubocop with Style/AccessModifierDeclarations's style set to "group" (the default).
RuboCop version
$ rubocop -V
0.57.0 (using Parser 2.5.1.0, running on ruby 2.5.1 x86_64-darwin17)