Class: Roodi::Checks::Check
- Inherits:
-
Object
- Object
- Roodi::Checks::Check
show all
- Defined in:
- lib/roodi/checks/check.rb
Direct Known Subclasses
AbcMetricMethodCheck, AssignmentInConditionalCheck, CaseMissingElseCheck, ClassVariableCheck, ControlCouplingCheck, CyclomaticComplexityCheck, EmptyRescueBodyCheck, ForLoopCheck, LineCountCheck, MissingForeignKeyIndexCheck, NameCheck, NpathComplexityCheck, ParameterNumberCheck
Constant Summary
collapse
- NODE_TYPES =
[:defn, :module, :resbody, :lvar, :cvar, :class, :if, :while, :until, :for, :rescue, :case, :when, :and, :or]
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Check
Returns a new instance of Check.
8
9
10
|
# File 'lib/roodi/checks/check.rb', line 8
def initialize
@errors = []
end
|
Instance Method Details
#add_error(error, filename = @node.file, line = @node.line) ⇒ Object
51
52
53
54
|
# File 'lib/roodi/checks/check.rb', line 51
def add_error(error, filename = @node.file, line = @node.line)
@errors ||= []
@errors << Roodi::Core::Error.new("#{filename}", "#{line}", error)
end
|
#end_file(filename) ⇒ Object
26
27
|
# File 'lib/roodi/checks/check.rb', line 26
def end_file(filename)
end
|
#errors ⇒ Object
56
57
58
|
# File 'lib/roodi/checks/check.rb', line 56
def errors
@errors
end
|
#evaluate_end(node) ⇒ Object
32
33
|
# File 'lib/roodi/checks/check.rb', line 32
def evaluate_end(node)
end
|
#evaluate_node(position, node) ⇒ Object
35
36
37
38
39
|
# File 'lib/roodi/checks/check.rb', line 35
def evaluate_node(position, node)
@node = node
eval_method = "evaluate_#{position}_#{node.node_type}"
self.send(eval_method, node)
end
|
#evaluate_node_end(node) ⇒ Object
46
47
48
49
|
# File 'lib/roodi/checks/check.rb', line 46
def evaluate_node_end(node)
evaluate_node(:end, node)
evaluate_end(node)
end
|
#evaluate_node_start(node) ⇒ Object
41
42
43
44
|
# File 'lib/roodi/checks/check.rb', line 41
def evaluate_node_start(node)
evaluate_node(:start, node)
evaluate_start(node)
end
|
#evaluate_start(node) ⇒ Object
29
30
|
# File 'lib/roodi/checks/check.rb', line 29
def evaluate_start(node)
end
|
#position(offset = 0) ⇒ Object
19
20
21
|
# File 'lib/roodi/checks/check.rb', line 19
def position(offset = 0)
"#{@line[2]}:#{@line[1] + offset}"
end
|
#start_file(filename) ⇒ Object
23
24
|
# File 'lib/roodi/checks/check.rb', line 23
def start_file(filename)
end
|