From e6aaa5f189a948fe6c74cac21ed28bba31b820b9 Mon Sep 17 00:00:00 2001 From: Denys Kurets Date: Tue, 10 Sep 2019 15:45:53 +0300 Subject: [PATCH] Fix #7320 support Naming/MethodName for attr_reader / attr_writer / attr_accessor --- CHANGELOG.md | 2 + lib/rubocop/cop/naming/method_name.rb | 25 +++++ spec/rubocop/cop/naming/method_name_spec.rb | 114 ++++++++++++++++++++ 3 files changed, 141 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fafc510f0b..2b88c5a081f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,7 @@ * [#7091](https://github.com/rubocop-hq/rubocop/issues/7091): `Style/FormatStringToken` now detects format sequences with flags and modifiers. ([@buehmann][]) * [#7319](https://github.com/rubocop-hq/rubocop/pull/7319): Rename `IgnoredMethodPatterns` option to `IgnoredPatterns` option for `Style/MethodCallWithArgsParentheses`. ([@koic][]) * [#7345](https://github.com/rubocop-hq/rubocop/issues/7345): Mark unsafe for `Style/YodaCondition`. ([@koic][]) +* [#7320](https://github.com/rubocop-hq/rubocop/issues/7320): Naming/MethodName doesn't flag attr_reader / attr_writer / attr_accessor. ([@denys281][]) ## 0.74.0 (2019-07-31) @@ -4248,3 +4249,4 @@ [@jdkaplan]: https://github.com/jdkaplan [@cstyles]: https://github.com/cstyles [@avmnu-sng]: https://github.com/avmnu-sng +[@denys281]: https://github.com/denys281 diff --git a/lib/rubocop/cop/naming/method_name.rb b/lib/rubocop/cop/naming/method_name.rb index e5be2dcdf70..eda3e5d6ea2 100644 --- a/lib/rubocop/cop/naming/method_name.rb +++ b/lib/rubocop/cop/naming/method_name.rb @@ -31,9 +31,27 @@ module Naming class MethodName < Cop include ConfigurableNaming include IgnoredPattern + include RangeHelp MSG = 'Use %