Class: Simplabs::Excellent::Checks::MethodNameCheck

Inherits:
NameCheck
  • Object
show all
Defined in:
lib/simplabs/excellent/checks/method_name_check.rb

Overview

This check reports methods with bad names. Badly named methods make reading and understanding the code much harder. Method names regarded as bad are for example:

  • names that are camel cased

Applies to

  • methods

Constant Summary collapse

DEFAULT_PATTERN =
/^[_a-z<>=\[|+-\/\*\~\%\&`\|\^]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/

Instance Attribute Summary

Attributes inherited from Base

#interesting_files, #interesting_nodes, #warnings

Instance Method Summary collapse

Methods inherited from NameCheck

#evaluate

Methods inherited from Base

#add_warning, #evaluate_node, #warnings_for

Constructor Details

#initialize(options = {}) ⇒ MethodNameCheck

:nodoc:



21
22
23
24
# File 'lib/simplabs/excellent/checks/method_name_check.rb', line 21

def initialize(options = {}) #:nodoc:
  pattern = options['pattern'] || DEFAULT_PATTERN
  super([:defn, :defs], pattern)
end