p8-metric_fu 0.8.4.10 → 0.8.4.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README +5 -3
- data/Rakefile +4 -3
- data/lib/metric_fu/base.rb +16 -6
- data/lib/tasks/metric_fu.rake +4 -2
- data/lib/tasks/metric_fu.rb +1 -1
- metadata +1 -1
data/README
CHANGED
@@ -50,14 +50,16 @@ Which will check for updates every 24 hours and run all the metrics rake tasks (
|
|
50
50
|
****Notes on configuration****
|
51
51
|
|
52
52
|
MetricFu::Configuration.run do |config|
|
53
|
-
|
53
|
+
#define which metrics you want to use
|
54
|
+
config.metrics = [:coverage, :flog]
|
55
|
+
# Don't open reports in the browser on a mac
|
56
|
+
config.open_in_browser = false
|
54
57
|
config.churn_options = { :start_date => lambda{ 3.months.ago } }
|
55
58
|
config.coverage_options = { :test_files => ['test/**/test_*.rb'] }
|
56
59
|
config.flog_options = { :dirs_to_flog => ['cms/app', 'cms/lib'] }
|
57
60
|
config.flay_options = { :dirs_to_flay => ['cms/app', 'cms/lib'] }
|
58
61
|
config.saikuro_options = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
|
59
|
-
|
60
|
-
...
|
62
|
+
|
61
63
|
end
|
62
64
|
|
63
65
|
****Notes on metrics:coverage****
|
data/Rakefile
CHANGED
@@ -8,6 +8,7 @@ Spec::Rake::SpecTask.new(:spec) do |t|
|
|
8
8
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
MetricFu::Configuration.run do |config|
|
12
|
+
config.metrics = [:flog]
|
13
|
+
end
|
14
|
+
task :default => [:"metrics:all"]
|
data/lib/metric_fu/base.rb
CHANGED
@@ -7,8 +7,10 @@ module MetricFu
|
|
7
7
|
|
8
8
|
if RAILS
|
9
9
|
CODE_DIRS = ['app', 'lib']
|
10
|
+
DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :railroad, :reek, :roodi, :stats, :saikuro ]
|
10
11
|
else
|
11
12
|
CODE_DIRS = ['lib']
|
13
|
+
DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :saikuro ]
|
12
14
|
end
|
13
15
|
|
14
16
|
module Base
|
@@ -96,6 +98,10 @@ module MetricFu
|
|
96
98
|
configuration.flog_options
|
97
99
|
end
|
98
100
|
|
101
|
+
def metrics
|
102
|
+
configuration.metrics
|
103
|
+
end
|
104
|
+
|
99
105
|
def open_in_browser?
|
100
106
|
PLATFORM['darwin'] && configuration.open_in_browser
|
101
107
|
end
|
@@ -107,24 +113,28 @@ module MetricFu
|
|
107
113
|
end
|
108
114
|
|
109
115
|
class Configuration
|
110
|
-
attr_accessor :churn_options, :coverage_options, :flay_options, :flog_options, :open_in_browser, :saikuro_options
|
116
|
+
attr_accessor :churn_options, :coverage_options, :flay_options, :flog_options, :metrics, :open_in_browser, :saikuro_options
|
111
117
|
def initialize
|
112
118
|
raise "Use config.churn_options instead of MetricFu::CHURN_OPTIONS" if defined? ::MetricFu::CHURN_OPTIONS
|
113
119
|
raise "Use config.flog_options[:dirs_to_flog] instead of MetricFu::DIRECTORIES_TO_FLOG" if defined? ::MetricFu::DIRECTORIES_TO_FLOG
|
114
120
|
raise "Use config.saikuro_options instead of MetricFu::SAIKURO_OPTIONS" if defined? ::MetricFu::SAIKURO_OPTIONS
|
115
121
|
reset
|
116
122
|
end
|
123
|
+
|
117
124
|
def self.run()
|
118
125
|
yield MetricFu.configuration
|
119
126
|
end
|
127
|
+
|
120
128
|
def reset
|
121
|
-
@churn_options
|
129
|
+
@churn_options = {}
|
122
130
|
@coverage_options = { :test_files => ['test/**/*_test.rb', 'spec/**/*_spec.rb'] }
|
123
|
-
@flay_options
|
124
|
-
@flog_options
|
125
|
-
@
|
126
|
-
@
|
131
|
+
@flay_options = { :dirs_to_flay => CODE_DIRS}
|
132
|
+
@flog_options = { :dirs_to_flog => CODE_DIRS}
|
133
|
+
@metrics = DEFAULT_METRICS
|
134
|
+
@open_in_browser = true
|
135
|
+
@saikuro_options = {}
|
127
136
|
end
|
137
|
+
|
128
138
|
def saikuro_options=(options)
|
129
139
|
raise "saikuro_options need to be a Hash" unless options.is_a?(Hash)
|
130
140
|
@saikuro_options = options
|
data/lib/tasks/metric_fu.rake
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
MetricFu.metrics.each { |task| import "#{File.dirname(__FILE__)}/#{task}.rake" }
|
2
|
+
|
1
3
|
namespace :metrics do
|
2
4
|
if MetricFu::RAILS
|
3
5
|
|
4
6
|
desc "Generate coverage, cyclomatic complexity, flog, flay, railroad, reek, roodi, stats and churn reports"
|
5
|
-
task :all =>
|
7
|
+
task :all => MetricFu.metrics
|
6
8
|
|
7
9
|
task :set_testing_env do
|
8
10
|
RAILS_ENV = 'test'
|
@@ -14,7 +16,7 @@ namespace :metrics do
|
|
14
16
|
else
|
15
17
|
|
16
18
|
desc "Generate coverage, cyclomatic complexity, flog, flay, railroad and churn reports"
|
17
|
-
task :all =>
|
19
|
+
task :all => MetricFu.metrics
|
18
20
|
|
19
21
|
end
|
20
22
|
|
data/lib/tasks/metric_fu.rb
CHANGED