Class: Pluginscan::VariableCheck

Inherits:
Check
  • Object
show all
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

Methods inherited from Check

#run

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

Returns:

  • (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