Class: Simplabs::Excellent::Checks::NameCheck
- Defined in:
- lib/simplabs/excellent/checks/name_check.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#interesting_contexts, #interesting_files, #options, #warnings
Instance Method Summary collapse
- #evaluate(context) ⇒ Object
-
#initialize(interesting_contexts, options = {}) ⇒ NameCheck
constructor
:nodoc:.
Methods inherited from Base
#add_warning, #evaluate_context, #warnings_for
Constructor Details
#initialize(interesting_contexts, options = {}) ⇒ NameCheck
:nodoc:
11 12 13 14 15 16 |
# File 'lib/simplabs/excellent/checks/name_check.rb', line 11 def initialize(interesting_contexts, = {}) #:nodoc: super() @interesting_contexts = interesting_contexts @pattern = Regexp.new([:pattern].to_s) @whitelist = Array([:whitelist]) end |
Instance Method Details
#evaluate(context) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/simplabs/excellent/checks/name_check.rb', line 18 def evaluate(context) name = context.name.to_s if !@whitelist.include?(name) && !(name =~ @pattern) add_warning(*warning_args(context)) end end |