Search code examples
ruby-on-railsrubyrubocop

What's different between AccessorMethodName and Style/AccessorMethodName


I've been searching a while and still don't know what's different between these AccessorMethodName and in .rubocop.yml configuration file?

Since I saw my coworker change Style/AccessorMethodName to AccessorMethodName.


Solution

  • Rubocop has (unbelievably) still not released v1.0 of the library. The developers still often make "breaking" changes by moving things around and altering behaviour.

    The AccessorMethodName cop was added to rubocop in v0.16. (Commit).

    In v0.50, it was renamed from Style/AccessorMethodName to Naming/AccessorMethodName.

    The exact behaviour of this cop, and the "correct name" for it, depends on your rubocop version. But essentially, it's the same thing.