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_<>=~@\[\]]*[=!\?]?$'
DEFAULT_WHITELIST =
%w([] ! !=  !~ % & * ** + +@ - -@ / < << <= <=> == === =~ > >= >> ^ ` | ~)

Instance Attribute Summary

Attributes inherited from Base

#interesting_contexts, #interesting_files, #options, #warnings

Instance Method Summary collapse

Methods inherited from NameCheck

#evaluate

Methods inherited from Base

#add_warning, #evaluate_context, #warnings_for

Constructor Details

#initialize(options = {}) ⇒ MethodNameCheck

:nodoc:



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

def initialize(options = {}) #:nodoc:
  options[:pattern]   ||= DEFAULT_PATTERN
  options[:whitelist] ||= DEFAULT_WHITELIST
  super([Parsing::MethodContext, Parsing::SingletonMethodContext], options)
end