From ac577f875da67c980a1aa0ba2c65774dcdb1e7dd Mon Sep 17 00:00:00 2001 From: Denys Kurets Date: Sat, 21 Mar 2020 16:36:08 +0200 Subject: [PATCH] [Fix #7320] Add support in Naming/MethodName for checking attribute names (#7372) --- CHANGELOG.md | 3 +- lib/rubocop/cop/naming/method_name.rb | 30 +++++ spec/rubocop/cop/naming/method_name_spec.rb | 126 ++++++++++++++++++++ 3 files changed, 158 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3f1e69b729..b36f7941bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -228,6 +228,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) @@ -4406,4 +4407,4 @@ [@jemmaissroff]: https://github.com/jemmaissroff [@nikitasakov]: https://github.com/nikitasakov [@dmolesUC]: https://github.com/dmolesUC -[@yuritomanek]: https://github.com/yuritomanek +[@yuritomanek]: https://github.com/yuritomanek \ No newline at end of file diff --git a/lib/rubocop/cop/naming/method_name.rb b/lib/rubocop/cop/naming/method_name.rb index e5be2dcdf70..38d90a3ea22 100644 --- a/lib/rubocop/cop/naming/method_name.rb +++ b/lib/rubocop/cop/naming/method_name.rb @@ -31,9 +31,28 @@ module Naming class MethodName < Cop include ConfigurableNaming include IgnoredPattern + include RangeHelp MSG = 'Use %