Class: Pluginscan::VariableCheck
- Defined in:
- lib/pluginscan/reports/issues_report/issue_checks/variable_check.rb
Overview
Extends Check with helpers for making patterns and ignores based on a list of variables or constantst
Instance Attribute Summary
Attributes inherited from Check
#ignores, #message, #name, #patterns
Instance Method Summary collapse
- #ignore?(variable, content) ⇒ Boolean
-
#initialize(check_hash) ⇒ VariableCheck
constructor
A new instance of VariableCheck.
Methods inherited from Check
Constructor Details
#initialize(check_hash) ⇒ VariableCheck
Returns a new instance of VariableCheck.
4 5 6 7 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/variable_check.rb', line 4 def initialize(check_hash) super(check_hash) @patterns = Array(check_hash[:variables]).map{ |var| Regexp.new(Regexp.escape(var)) } end |
Instance Method Details
#ignore?(variable, content) ⇒ Boolean
9 10 11 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/variable_check.rb', line 9 def ignore?(variable, content) VariableSafetyChecker.new.all_safe?(variable, content) || CommentChecker.commented?(content) end |