Class: Simplabs::Excellent::Checks::MethodNameCheck
- 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
-
#initialize(options = {}) ⇒ MethodNameCheck
constructor
:nodoc:.
Methods inherited from NameCheck
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( = {}) #:nodoc: [:pattern] ||= DEFAULT_PATTERN [:whitelist] ||= DEFAULT_WHITELIST super([Parsing::MethodContext, Parsing::SingletonMethodContext], ) end |