Skip to content

Commit

Permalink
[Fix rubocop#7801] Update documentation for Naming/AccessorMethodName.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvandersluis committed Dec 8, 2020
1 parent ebd90fb commit b834530
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/rubocop/cop/naming/accessor_method_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
module RuboCop
module Cop
module Naming
# This cop makes sure that accessor methods are named properly.
# This cop makes sure that accessor methods are named properly. Applies
# to both instance and class methods.
#
# NOTE: Offenses are only registered for methods with the expected
# arity. Getters (`get_attribute`) must have no arguments to be
# registered, and setters (`set_attribute(value)`) must have exactly
# one.
#
# @example
# # bad
Expand All @@ -21,6 +27,14 @@ module Naming
# # good
# def attribute
# end
#
# # accepted, incorrect arity for getter
# def get_value(attr)
# end
#
# # accepted, incorrect arity for setter
# def set_value
# end
class AccessorMethodName < Base
MSG_READER = 'Do not prefix reader method names with `get_`.'
MSG_WRITER = 'Do not prefix writer method names with `set_`.'
Expand Down

0 comments on commit b834530

Please sign in to comment.