File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33module RuboCop
44 module Cop
55 module Naming
6- # This cop makes sure that accessor methods are named properly.
6+ # This cop makes sure that accessor methods are named properly. Applies
7+ # to both instance and class methods.
8+ #
9+ # NOTE: Offenses are only registered for methods with the expected
10+ # arity. Getters (`get_attribute`) must have no arguments to be
11+ # registered, and setters (`set_attribute(value)`) must have exactly
12+ # one.
713 #
814 # @example
915 # # bad
@@ -21,6 +27,14 @@ module Naming
2127 # # good
2228 # def attribute
2329 # end
30+ #
31+ # # accepted, incorrect arity for getter
32+ # def get_value(attr)
33+ # end
34+ #
35+ # # accepted, incorrect arity for setter
36+ # def set_value
37+ # end
2438 class AccessorMethodName < Base
2539 MSG_READER = 'Do not prefix reader method names with `get_`.'
2640 MSG_WRITER = 'Do not prefix writer method names with `set_`.'
You can’t perform that action at this time.
0 commit comments