Skip to content

Commit 9299422

Browse files
committed
Add new tasks for code metrics.
1 parent f5fb572 commit 9299422

File tree

6 files changed

+60
-0
lines changed

6 files changed

+60
-0
lines changed

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ group :development, :test do
77
gem 'growl', :require => false if RUBY_PLATFORM =~ /darwin/i
88
gem 'growl_notify', :require => false if RUBY_PLATFORM =~ /darwin/i
99
end
10+
11+
group :metrics do
12+
gem 'reek', '~> 1.2.12'
13+
gem 'roodi', '~> 2.1.0'
14+
end

Gemfile.lock

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ GEM
5050
rake (0.9.2.2)
5151
rb-appscript (0.6.1)
5252
rb-fsevent (0.9.1)
53+
reek (1.2.12)
54+
ripper_ruby_parser (~> 0.0.7)
55+
ruby2ruby (~> 1.2.5)
56+
ruby_parser (~> 2.0)
57+
sexp_processor (~> 3.0)
58+
ripper_ruby_parser (0.0.8)
59+
sexp_processor (~> 3.0)
60+
roodi (2.1.0)
61+
ruby_parser
5362
rspec (2.10.0)
5463
rspec-core (~> 2.10.0)
5564
rspec-expectations (~> 2.10.0)
@@ -58,6 +67,12 @@ GEM
5867
rspec-expectations (2.10.0)
5968
diff-lcs (~> 1.1.3)
6069
rspec-mocks (2.10.1)
70+
ruby2ruby (1.2.5)
71+
ruby_parser (~> 2.0)
72+
sexp_processor (~> 3.0)
73+
ruby_parser (2.3.1)
74+
sexp_processor (~> 3.0)
75+
sexp_processor (3.2.0)
6176
simplecov (0.7.1)
6277
multi_json (~> 1.0)
6378
simplecov-html (~> 0.7.1)
@@ -83,6 +98,8 @@ DEPENDENCIES
8398
guard-rspec
8499
rake
85100
rb-fsevent
101+
reek (~> 1.2.12)
102+
roodi (~> 2.1.0)
86103
rspec
87104
simplecov (~> 0.7.1)
88105
vcr (~> 2.2.0)

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ end
1010

1111
Cucumber::Rake::Task.new(:features)
1212

13+
FileList['tasks/**/*.rake'].each { |task| import task }
14+
1315
task :default => [:spec, :features]

tasks/metrics/reek.rake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
begin
2+
require 'reek/rake/task'
3+
4+
namespace :metrics do
5+
Reek::Rake::Task.new
6+
end
7+
rescue LoadError
8+
task :reek do
9+
abort "Reek is not available. In order to run reek, you must: gem install reek"
10+
end
11+
end

tasks/metrics/roodi.rake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
begin
2+
require 'roodi'
3+
require 'rake/tasklib'
4+
require 'roodi_task'
5+
6+
namespace :metrics do
7+
RoodiTask.new do |t|
8+
t.verbose = false
9+
t.config = File.expand_path('../roodi.yml', __FILE__)
10+
t.patterns = %w[ lib/**/*.rb ]
11+
end
12+
end
13+
rescue LoadError
14+
task :roodi do
15+
abort "Roodi is not available. In order to run roodi, you must: gem install roodi"
16+
end
17+
end

tasks/metrics/roodi.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
AbcMetricMethodCheck: { score: 10.3 }
3+
AssignmentInConditionalCheck: { }
4+
CaseMissingElseCheck: { }
5+
ClassLineCountCheck: { line_count: 293 }
6+
ClassVariableCheck: { }
7+
CyclomaticComplexityBlockCheck: { complexity: 2 }
8+
CyclomaticComplexityMethodCheck: { complexity: 4 }

0 commit comments

Comments
 (0)