simplabs-excellent 1.0.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/History.txt +19 -0
  2. data/README.rdoc +34 -0
  3. data/VERSION.yml +1 -1
  4. data/bin/excellent +21 -6
  5. data/lib/simplabs/excellent.rb +7 -5
  6. data/lib/simplabs/excellent/checks.rb +18 -1
  7. data/lib/simplabs/excellent/checks/abc_metric_method_check.rb +19 -56
  8. data/lib/simplabs/excellent/checks/assignment_in_conditional_check.rb +16 -16
  9. data/lib/simplabs/excellent/checks/base.rb +30 -21
  10. data/lib/simplabs/excellent/checks/case_missing_else_check.rb +13 -5
  11. data/lib/simplabs/excellent/checks/class_line_count_check.rb +10 -8
  12. data/lib/simplabs/excellent/checks/class_name_check.rb +11 -10
  13. data/lib/simplabs/excellent/checks/control_coupling_check.rb +13 -10
  14. data/lib/simplabs/excellent/checks/cyclomatic_complexity_block_check.rb +25 -9
  15. data/lib/simplabs/excellent/checks/cyclomatic_complexity_check.rb +4 -20
  16. data/lib/simplabs/excellent/checks/cyclomatic_complexity_method_check.rb +25 -10
  17. data/lib/simplabs/excellent/checks/duplication_check.rb +50 -0
  18. data/lib/simplabs/excellent/checks/empty_rescue_body_check.rb +10 -18
  19. data/lib/simplabs/excellent/checks/flog_block_check.rb +40 -0
  20. data/lib/simplabs/excellent/checks/flog_check.rb +27 -0
  21. data/lib/simplabs/excellent/checks/flog_class_check.rb +40 -0
  22. data/lib/simplabs/excellent/checks/flog_method_check.rb +40 -0
  23. data/lib/simplabs/excellent/checks/for_loop_check.rb +20 -4
  24. data/lib/simplabs/excellent/checks/line_count_check.rb +3 -21
  25. data/lib/simplabs/excellent/checks/method_line_count_check.rb +9 -7
  26. data/lib/simplabs/excellent/checks/method_name_check.rb +13 -9
  27. data/lib/simplabs/excellent/checks/module_line_count_check.rb +9 -7
  28. data/lib/simplabs/excellent/checks/module_name_check.rb +11 -7
  29. data/lib/simplabs/excellent/checks/name_check.rb +3 -8
  30. data/lib/simplabs/excellent/checks/nested_iterators_check.rb +33 -0
  31. data/lib/simplabs/excellent/checks/parameter_number_check.rb +13 -12
  32. data/lib/simplabs/excellent/checks/rails.rb +17 -0
  33. data/lib/simplabs/excellent/checks/rails/attr_accessible_check.rb +38 -0
  34. data/lib/simplabs/excellent/checks/rails/attr_protected_check.rb +39 -0
  35. data/lib/simplabs/excellent/checks/singleton_variable_check.rb +32 -0
  36. data/lib/simplabs/excellent/extensions/sexp.rb +21 -0
  37. data/lib/simplabs/excellent/extensions/string.rb +23 -0
  38. data/lib/simplabs/excellent/parsing.rb +12 -0
  39. data/lib/simplabs/excellent/parsing/abc_measure.rb +52 -0
  40. data/lib/simplabs/excellent/parsing/block_context.rb +43 -0
  41. data/lib/simplabs/excellent/parsing/call_context.rb +36 -0
  42. data/lib/simplabs/excellent/parsing/case_context.rb +31 -0
  43. data/lib/simplabs/excellent/parsing/class_context.rb +68 -0
  44. data/lib/simplabs/excellent/parsing/code_processor.rb +154 -0
  45. data/lib/simplabs/excellent/parsing/conditional_context.rb +25 -0
  46. data/lib/simplabs/excellent/parsing/cvar_context.rb +28 -0
  47. data/lib/simplabs/excellent/parsing/cyclomatic_complexity_measure.rb +73 -0
  48. data/lib/simplabs/excellent/parsing/flog_measure.rb +192 -0
  49. data/lib/simplabs/excellent/parsing/for_loop_context.rb +15 -0
  50. data/lib/simplabs/excellent/parsing/if_context.rb +38 -0
  51. data/lib/simplabs/excellent/parsing/method_context.rb +50 -0
  52. data/lib/simplabs/excellent/parsing/module_context.rb +29 -0
  53. data/lib/simplabs/excellent/{core → parsing}/parser.rb +4 -2
  54. data/lib/simplabs/excellent/parsing/resbody_context.rb +39 -0
  55. data/lib/simplabs/excellent/parsing/scopeable.rb +34 -0
  56. data/lib/simplabs/excellent/parsing/sexp_context.rb +125 -0
  57. data/lib/simplabs/excellent/parsing/singleton_method_context.rb +55 -0
  58. data/lib/simplabs/excellent/parsing/until_context.rb +24 -0
  59. data/lib/simplabs/excellent/parsing/while_context.rb +24 -0
  60. data/lib/simplabs/excellent/runner.rb +105 -0
  61. data/lib/simplabs/excellent/warning.rb +53 -0
  62. data/spec/checks/abc_metric_method_check_spec.rb +36 -8
  63. data/spec/checks/assignment_in_conditional_check_spec.rb +31 -14
  64. data/spec/checks/case_missing_else_check_spec.rb +8 -8
  65. data/spec/checks/class_line_count_check_spec.rb +24 -11
  66. data/spec/checks/class_name_check_spec.rb +9 -9
  67. data/spec/checks/control_coupling_check_spec.rb +84 -13
  68. data/spec/checks/cyclomatic_complexity_block_check_spec.rb +13 -17
  69. data/spec/checks/cyclomatic_complexity_method_check_spec.rb +32 -6
  70. data/spec/checks/duplication_check_spec.rb +139 -0
  71. data/spec/checks/empty_rescue_body_check_spec.rb +54 -16
  72. data/spec/checks/flog_block_check_spec.rb +28 -0
  73. data/spec/checks/flog_class_check_spec.rb +28 -0
  74. data/spec/checks/flog_method_check_spec.rb +46 -0
  75. data/spec/checks/for_loop_check_spec.rb +11 -11
  76. data/spec/checks/method_line_count_check_spec.rb +11 -12
  77. data/spec/checks/method_name_check_spec.rb +34 -13
  78. data/spec/checks/module_line_count_check_spec.rb +11 -12
  79. data/spec/checks/module_name_check_spec.rb +31 -7
  80. data/spec/checks/nested_iterators_check_spec.rb +44 -0
  81. data/spec/checks/parameter_number_check_spec.rb +48 -12
  82. data/spec/checks/rails/attr_accessible_check_spec.rb +79 -0
  83. data/spec/checks/rails/attr_protected_check_spec.rb +77 -0
  84. data/spec/checks/singleton_variable_check_spec.rb +66 -0
  85. data/spec/{core/extensions/underscore_spec.rb → extensions/string_spec.rb} +1 -1
  86. metadata +58 -15
  87. data/README.markdown +0 -30
  88. data/lib/simplabs/excellent/checks/class_variable_check.rb +0 -25
  89. data/lib/simplabs/excellent/core.rb +0 -2
  90. data/lib/simplabs/excellent/core/checking_visitor.rb +0 -34
  91. data/lib/simplabs/excellent/core/error.rb +0 -31
  92. data/lib/simplabs/excellent/core/extensions/underscore.rb +0 -27
  93. data/lib/simplabs/excellent/core/iterator_visitor.rb +0 -29
  94. data/lib/simplabs/excellent/core/parse_tree_runner.rb +0 -88
  95. data/lib/simplabs/excellent/core/visitable_sexp.rb +0 -31
  96. data/spec/checks/class_variable_check_spec.rb +0 -26
@@ -0,0 +1,66 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Simplabs::Excellent::Checks::SingletonVariableCheck do
4
+
5
+ before(:each) do
6
+ @excellent = Simplabs::Excellent::Runner.new(Simplabs::Excellent::Checks::SingletonVariableCheck.new)
7
+ end
8
+
9
+ describe '#evaluate' do
10
+
11
+ it 'should reject singleton variables' do
12
+ content = <<-END
13
+ @@foo
14
+ END
15
+ @excellent.check_content(content)
16
+ warnings = @excellent.warnings
17
+
18
+ warnings.should_not be_empty
19
+ warnings[0].info.should == { :variable => 'foo' }
20
+ warnings[0].line_number.should == 2
21
+ warnings[0].message.should == 'Singleton variable foo used.'
22
+ end
23
+
24
+ it 'should also work for namespaced classes' do
25
+ content = <<-END
26
+ module Outer
27
+ module Inner
28
+ class Class
29
+ @@foo
30
+ end
31
+ end
32
+ end
33
+ END
34
+ @excellent.check_content(content)
35
+ warnings = @excellent.warnings
36
+
37
+ warnings.should_not be_empty
38
+ warnings[0].info.should == { :variable => 'Outer::Inner::Class.foo' }
39
+ warnings[0].line_number.should == 5
40
+ warnings[0].message.should == 'Singleton variable Outer::Inner::Class.foo used.'
41
+ end
42
+
43
+ it 'should also work for singleton variables that occur within methods' do
44
+ content = <<-END
45
+ module Outer
46
+ module Inner
47
+ class Class
48
+ def method
49
+ @@foo
50
+ end
51
+ end
52
+ end
53
+ end
54
+ END
55
+ @excellent.check_content(content)
56
+ warnings = @excellent.warnings
57
+
58
+ warnings.should_not be_empty
59
+ warnings[0].info.should == { :variable => 'Outer::Inner::Class.foo' }
60
+ warnings[0].line_number.should == 6
61
+ warnings[0].message.should == 'Singleton variable Outer::Inner::Class.foo used.'
62
+ end
63
+
64
+ end
65
+
66
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe String do
4
4
 
metadata CHANGED
@@ -1,10 +1,9 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplabs-excellent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - Marty Andrews
8
7
  - Marco Otte-Witte
9
8
  autorequire:
10
9
  bindir: bin
@@ -23,6 +22,16 @@ dependencies:
23
22
  - !ruby/object:Gem::Version
24
23
  version: "2.0"
25
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: sexp_processor
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "3.0"
34
+ version:
26
35
  description:
27
36
  email: marco.otte-witte@simplabs.com
28
37
  executables:
@@ -33,7 +42,7 @@ extra_rdoc_files: []
33
42
 
34
43
  files:
35
44
  - History.txt
36
- - README.markdown
45
+ - README.rdoc
37
46
  - VERSION.yml
38
47
  - bin/excellent
39
48
  - lib/simplabs/excellent/checks/abc_metric_method_check.rb
@@ -42,12 +51,16 @@ files:
42
51
  - lib/simplabs/excellent/checks/case_missing_else_check.rb
43
52
  - lib/simplabs/excellent/checks/class_line_count_check.rb
44
53
  - lib/simplabs/excellent/checks/class_name_check.rb
45
- - lib/simplabs/excellent/checks/class_variable_check.rb
46
54
  - lib/simplabs/excellent/checks/control_coupling_check.rb
47
55
  - lib/simplabs/excellent/checks/cyclomatic_complexity_block_check.rb
48
56
  - lib/simplabs/excellent/checks/cyclomatic_complexity_check.rb
49
57
  - lib/simplabs/excellent/checks/cyclomatic_complexity_method_check.rb
58
+ - lib/simplabs/excellent/checks/duplication_check.rb
50
59
  - lib/simplabs/excellent/checks/empty_rescue_body_check.rb
60
+ - lib/simplabs/excellent/checks/flog_block_check.rb
61
+ - lib/simplabs/excellent/checks/flog_check.rb
62
+ - lib/simplabs/excellent/checks/flog_class_check.rb
63
+ - lib/simplabs/excellent/checks/flog_method_check.rb
51
64
  - lib/simplabs/excellent/checks/for_loop_check.rb
52
65
  - lib/simplabs/excellent/checks/line_count_check.rb
53
66
  - lib/simplabs/excellent/checks/method_line_count_check.rb
@@ -55,34 +68,64 @@ files:
55
68
  - lib/simplabs/excellent/checks/module_line_count_check.rb
56
69
  - lib/simplabs/excellent/checks/module_name_check.rb
57
70
  - lib/simplabs/excellent/checks/name_check.rb
71
+ - lib/simplabs/excellent/checks/nested_iterators_check.rb
58
72
  - lib/simplabs/excellent/checks/parameter_number_check.rb
73
+ - lib/simplabs/excellent/checks/rails/attr_accessible_check.rb
74
+ - lib/simplabs/excellent/checks/rails/attr_protected_check.rb
75
+ - lib/simplabs/excellent/checks/rails.rb
76
+ - lib/simplabs/excellent/checks/singleton_variable_check.rb
59
77
  - lib/simplabs/excellent/checks.rb
60
- - lib/simplabs/excellent/core/checking_visitor.rb
61
- - lib/simplabs/excellent/core/error.rb
62
- - lib/simplabs/excellent/core/extensions/underscore.rb
63
- - lib/simplabs/excellent/core/iterator_visitor.rb
64
- - lib/simplabs/excellent/core/parse_tree_runner.rb
65
- - lib/simplabs/excellent/core/parser.rb
66
- - lib/simplabs/excellent/core/visitable_sexp.rb
67
- - lib/simplabs/excellent/core.rb
78
+ - lib/simplabs/excellent/extensions/sexp.rb
79
+ - lib/simplabs/excellent/extensions/string.rb
80
+ - lib/simplabs/excellent/parsing/abc_measure.rb
81
+ - lib/simplabs/excellent/parsing/block_context.rb
82
+ - lib/simplabs/excellent/parsing/call_context.rb
83
+ - lib/simplabs/excellent/parsing/case_context.rb
84
+ - lib/simplabs/excellent/parsing/class_context.rb
85
+ - lib/simplabs/excellent/parsing/code_processor.rb
86
+ - lib/simplabs/excellent/parsing/conditional_context.rb
87
+ - lib/simplabs/excellent/parsing/cvar_context.rb
88
+ - lib/simplabs/excellent/parsing/cyclomatic_complexity_measure.rb
89
+ - lib/simplabs/excellent/parsing/flog_measure.rb
90
+ - lib/simplabs/excellent/parsing/for_loop_context.rb
91
+ - lib/simplabs/excellent/parsing/if_context.rb
92
+ - lib/simplabs/excellent/parsing/method_context.rb
93
+ - lib/simplabs/excellent/parsing/module_context.rb
94
+ - lib/simplabs/excellent/parsing/parser.rb
95
+ - lib/simplabs/excellent/parsing/resbody_context.rb
96
+ - lib/simplabs/excellent/parsing/scopeable.rb
97
+ - lib/simplabs/excellent/parsing/sexp_context.rb
98
+ - lib/simplabs/excellent/parsing/singleton_method_context.rb
99
+ - lib/simplabs/excellent/parsing/until_context.rb
100
+ - lib/simplabs/excellent/parsing/while_context.rb
101
+ - lib/simplabs/excellent/parsing.rb
102
+ - lib/simplabs/excellent/runner.rb
103
+ - lib/simplabs/excellent/warning.rb
68
104
  - lib/simplabs/excellent.rb
69
105
  - spec/checks/abc_metric_method_check_spec.rb
70
106
  - spec/checks/assignment_in_conditional_check_spec.rb
71
107
  - spec/checks/case_missing_else_check_spec.rb
72
108
  - spec/checks/class_line_count_check_spec.rb
73
109
  - spec/checks/class_name_check_spec.rb
74
- - spec/checks/class_variable_check_spec.rb
75
110
  - spec/checks/control_coupling_check_spec.rb
76
111
  - spec/checks/cyclomatic_complexity_block_check_spec.rb
77
112
  - spec/checks/cyclomatic_complexity_method_check_spec.rb
113
+ - spec/checks/duplication_check_spec.rb
78
114
  - spec/checks/empty_rescue_body_check_spec.rb
115
+ - spec/checks/flog_block_check_spec.rb
116
+ - spec/checks/flog_class_check_spec.rb
117
+ - spec/checks/flog_method_check_spec.rb
79
118
  - spec/checks/for_loop_check_spec.rb
80
119
  - spec/checks/method_line_count_check_spec.rb
81
120
  - spec/checks/method_name_check_spec.rb
82
121
  - spec/checks/module_line_count_check_spec.rb
83
122
  - spec/checks/module_name_check_spec.rb
123
+ - spec/checks/nested_iterators_check_spec.rb
84
124
  - spec/checks/parameter_number_check_spec.rb
85
- - spec/core/extensions/underscore_spec.rb
125
+ - spec/checks/rails/attr_accessible_check_spec.rb
126
+ - spec/checks/rails/attr_protected_check_spec.rb
127
+ - spec/checks/singleton_variable_check_spec.rb
128
+ - spec/extensions/string_spec.rb
86
129
  - spec/spec_helper.rb
87
130
  has_rdoc: true
88
131
  homepage: http://github.com/simplabs/excellent
@@ -110,6 +153,6 @@ rubyforge_project:
110
153
  rubygems_version: 1.2.0
111
154
  signing_key:
112
155
  specification_version: 2
113
- summary: Source code analysis gem
156
+ summary: Source Code analysis gem for Ruby and Rails
114
157
  test_files: []
115
158
 
data/README.markdown DELETED
@@ -1,30 +0,0 @@
1
- simplabs-excellent
2
- ==================
3
-
4
- Excellent is a source code analysis gem. It detects commonly regarded bad code snippets
5
- like empty rescue blocks etc.
6
-
7
- Installation
8
- ------------
9
-
10
- gem sources -a http://gems.github.com
11
- sudo gem install simplabs-excellent
12
-
13
- Example
14
- -------
15
-
16
- To analyse all the models in your Rails application, just do
17
-
18
- excellent "app/models/**/*.rb"
19
-
20
- in your RAILS_ROOT.
21
-
22
- Acknowledgements
23
- ----------------
24
-
25
- Excellent is based on roodi by Marty Andrews. However, it will get more functionaliy than roodi in the future.
26
-
27
- Author
28
- ------
29
-
30
- Copyright (c) 2009 Marco Otte-Witte (http://simplabs.com), released under the MIT license
@@ -1,25 +0,0 @@
1
- require 'simplabs/excellent/checks/base'
2
-
3
- module Simplabs
4
-
5
- module Excellent
6
-
7
- module Checks
8
-
9
- class ClassVariableCheck < Base
10
-
11
- def interesting_nodes
12
- [:cvar]
13
- end
14
-
15
- def evaluate(node)
16
- add_error('Class variable {{variable}}.', { :variable => node.value }, -1)
17
- end
18
-
19
- end
20
-
21
- end
22
-
23
- end
24
-
25
- end
@@ -1,2 +0,0 @@
1
- require 'simplabs/excellent/core/parse_tree_runner'
2
- require 'simplabs/excellent/core/extensions/underscore'
@@ -1,34 +0,0 @@
1
- module Simplabs
2
-
3
- module Excellent
4
-
5
- module Core
6
-
7
- class CheckingVisitor
8
-
9
- def initialize(*checks)
10
- @checks ||= {}
11
- checks.first.each do |check|
12
- nodes = check.interesting_nodes
13
- nodes.each do |node|
14
- @checks[node] ||= []
15
- @checks[node] << check
16
- @checks[node].uniq!
17
- end
18
- end
19
- end
20
-
21
- def visit(node)
22
- @last_newline = node if node.node_type == :newline
23
- checks = @checks[node.node_type]
24
- checks.each { |check| check.evaluate_node(node) } unless checks.nil?
25
- nil
26
- end
27
-
28
- end
29
-
30
- end
31
-
32
- end
33
-
34
- end
@@ -1,31 +0,0 @@
1
- module Simplabs
2
-
3
- module Excellent
4
-
5
- module Core
6
-
7
- class Error
8
-
9
- attr_reader :check, :info, :filename, :line_number, :message, :message_template
10
-
11
- def initialize(check, message, filename, line_number, info)
12
- @check = check.to_s.underscore.to_sym
13
- @info = info
14
- @filename = filename
15
- @line_number = line_number.to_i
16
-
17
- @message = ''
18
- if !message.nil?
19
- @message_template = message
20
- @info.each { |key, value| message.gsub!(/\{\{#{key}\}\}/, value.to_s) }
21
- @message = message
22
- end
23
- end
24
-
25
- end
26
-
27
- end
28
-
29
- end
30
-
31
- end
@@ -1,27 +0,0 @@
1
- module Simplabs
2
-
3
- module Excellent
4
-
5
- module Core
6
-
7
- module Extensions
8
-
9
- ::String.class_eval do
10
-
11
- def underscore
12
- to_s.gsub(/::/, '/').
13
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
14
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
15
- tr("-", "_").
16
- downcase
17
- end
18
-
19
- end
20
-
21
- end
22
-
23
- end
24
-
25
- end
26
-
27
- end
@@ -1,29 +0,0 @@
1
- module Simplabs
2
-
3
- module Excellent
4
-
5
- module Core
6
-
7
- class IteratorVisitor
8
-
9
- def initialize(payload)
10
- @payload = payload
11
- end
12
-
13
- def visit(visited)
14
- visited.accept(@payload)
15
- visitable_nodes = visited.is_language_node? ? visited.sexp_body : visited
16
- visitable_nodes.each do |child|
17
- if child.is_a?(Sexp) then
18
- child.accept(self)
19
- end
20
- end
21
- end
22
-
23
- end
24
-
25
- end
26
-
27
- end
28
-
29
- end
@@ -1,88 +0,0 @@
1
- require 'pp'
2
- require 'yaml'
3
-
4
- require 'simplabs/excellent/core/checking_visitor'
5
- require 'simplabs/excellent/core/iterator_visitor'
6
- require 'simplabs/excellent/core/parser'
7
- require 'simplabs/excellent/core/visitable_sexp'
8
-
9
- module Simplabs
10
-
11
- module Excellent
12
-
13
- module Core
14
-
15
- class ParseTreeRunner
16
-
17
- DEFAULT_CONFIG = {
18
- :AssignmentInConditionalCheck => { },
19
- :CaseMissingElseCheck => { },
20
- :ClassLineCountCheck => { :threshold => 300 },
21
- :ClassNameCheck => { :pattern => /^[A-Z][a-zA-Z0-9]*$/ },
22
- :ClassVariableCheck => { },
23
- :CyclomaticComplexityBlockCheck => { :complexity => 4 },
24
- :CyclomaticComplexityMethodCheck => { :complexity => 8 },
25
- :EmptyRescueBodyCheck => { },
26
- :ForLoopCheck => { },
27
- :MethodLineCountCheck => { :line_count => 20 },
28
- :MethodNameCheck => { :pattern => /^[_a-z<>=\[|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ },
29
- :ModuleLineCountCheck => { :line_count => 300 },
30
- :ModuleNameCheck => { :pattern => /^[A-Z][a-zA-Z0-9]*$/ },
31
- :ParameterNumberCheck => { :parameter_count => 3 }
32
- }
33
-
34
- attr_writer :config
35
-
36
- def initialize(*checks)
37
- @config = DEFAULT_CONFIG
38
- @checks = checks unless checks.empty?
39
- @parser = Parser.new
40
- end
41
-
42
- def check(filename, content)
43
- @checks ||= load_checks
44
- node = parse(filename, content)
45
- node.accept(IteratorVisitor.new(CheckingVisitor.new(@checks))) if node
46
- end
47
-
48
- def check_content(content)
49
- check("dummy-file.rb", content)
50
- end
51
-
52
- def check_file(filename)
53
- check(filename, File.read(filename))
54
- end
55
-
56
- def errors
57
- @checks ||= []
58
- all_errors = @checks.collect {|check| check.errors}
59
- all_errors.flatten
60
- end
61
-
62
- private
63
-
64
- def parse(filename, content)
65
- begin
66
- @parser.parse(content, filename)
67
- rescue Exception => e
68
- puts "#{filename} looks like it's not a valid Ruby file. Skipping..." if ENV["ROODI_DEBUG"]
69
- nil
70
- end
71
- end
72
-
73
- def load_checks
74
- check_objects = []
75
- DEFAULT_CONFIG.each_pair do |key, value|
76
- klass = eval("Simplabs::Excellent::Checks::#{key.to_s}")
77
- check_objects << (value.empty? ? klass.new : klass.new(value))
78
- end
79
- check_objects
80
- end
81
-
82
- end
83
-
84
- end
85
-
86
- end
87
-
88
- end