Class: Pluginscan::FunctionCheck
- Inherits:
-
Check
- Object
- Check
- Pluginscan::FunctionCheck
show all
- Defined in:
- lib/pluginscan/reports/issues_report/issue_checks/function_check.rb
Overview
Extends Check with helpers for making patterns and ignores based on a list of function names
Instance Attribute Summary
Attributes inherited from Check
#ignores, #message, #name, #patterns
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Check
#ignore?, #run
Constructor Details
Returns a new instance of FunctionCheck.
4
5
6
7
8
9
|
# File 'lib/pluginscan/reports/issues_report/issue_checks/function_check.rb', line 4
def initialize(check_hash)
check_hash.default = []
check_hash[:patterns] = self.class.patterns(check_hash[:patterns], check_hash[:function_names])
check_hash[:ignores] = self.class.ignores(check_hash[:ignores], check_hash[:function_names])
super(check_hash)
end
|
Class Method Details
.function_ignores(functions) ⇒ Object
19
20
21
22
|
# File 'lib/pluginscan/reports/issues_report/issue_checks/function_check.rb', line 19
def self.function_ignores(functions)
functions.map { |function| Regexp.new("function\s+[^a-z0-9|_]?#{function}\s*\\(") }
end
|
.function_list(functions) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/pluginscan/reports/issues_report/issue_checks/function_check.rb', line 11
def self.function_list(functions)
functions.map{ |function| Regexp.new("(^|[^a-z0-9|_])(#{function})\s*\\(") }
end
|
.ignores(ignores, function_names) ⇒ Object
28
29
30
|
# File 'lib/pluginscan/reports/issues_report/issue_checks/function_check.rb', line 28
def self.ignores(ignores, function_names)
Array(ignores) + function_ignores(function_names) + CommentChecker::COMMENT_REGEXPS
end
|
.patterns(patterns, function_names) ⇒ Object
24
25
26
|
# File 'lib/pluginscan/reports/issues_report/issue_checks/function_check.rb', line 24
def self.patterns(patterns, function_names)
Array(patterns) + function_list(function_names)
end
|