Class: Ducalis::ModuleLikeClass
- Inherits:
-
RuboCop::Cop::Cop
- Object
- RuboCop::Cop::Cop
- Ducalis::ModuleLikeClass
- Includes:
- RuboCop::Cop::DefNode
- Defined in:
- lib/ducalis/cops/module_like_class.rb
Constant Summary collapse
- OFFENSE =
<<-MESSAGE.gsub(/^ +\|\s/, '').strip | Seems like it will be better to define initialize and pass %<args>s there instead of each method. MESSAGE
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ducalis/cops/module_like_class.rb', line 13 def on_class(node) _name, inheritance, body = *node return if !inheritance.nil? || body.nil? || allowed_include?(body) matched = matched_args(body) return if matched.empty? add_offense(node, :expression, format(OFFENSE, args: matched.map { |arg| "`#{arg}`" }.join(', '))) end |