Class: Ducalis::BlackListSuffix

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Defined in:
lib/ducalis/cops/black_list_suffix.rb

Constant Summary collapse

OFFENSE =
<<-MESSAGE.gsub(/^ +\|\s/, '').strip
  | Please, avoid using of class suffixes like `Manager`, `Client` and so on. If it has no parts, change the name of the class to what each object is managing.

  | It's ok to use Manager as subclass of Person, which is there to refine a type of personal that has management behavior to it.
MESSAGE
DETAILS =
<<-MESSAGE.gsub(/^ +\|\s/, '').strip
  | Related [article](<http://www.carlopescio.com/2011/04/your-coding-conventions-are-hurting-you.html>)
MESSAGE

Instance Method Summary collapse

Instance Method Details

#on_class(node) ⇒ Object



17
18
19
20
21
22
# File 'lib/ducalis/cops/black_list_suffix.rb', line 17

def on_class(node)
  classdef_node, _superclass, _body = *node
  return unless with_blacklisted_suffix?(classdef_node.source)

  add_offense(node, :expression, OFFENSE)
end