forked from strika/clearbooks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.metrics
113 lines (75 loc) · 3.24 KB
/
.metrics
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env ruby
# System libs
require 'awesome_print'
require 'fileutils'
require 'simplecov'
require 'simplecov-rcov-text'
MetricFu::Configuration.run do |config|
# Get directories we want to cover
files = Dir.glob( "lib/**/*.rb" )
paths = files.collect! { |dir| File.dirname( dir ) }.uniq
puts "(II) Running on the following folders: "
ap paths
puts ""
### Basic config
config.verbose = false
# config.configure_formatter(:yaml, "customreport.yml")
### Turn off some tools per default
config.configure_metrics.each do |metric| # {{{
name = metric.name
metric.enabled = false if( name == :rails_best_practices ) # metric.is_a? MetricFu::MetricRailsBestPractices
# dies with /metric_fu-4.5.2/lib/metric_fu/metrics/stats/stats.rb:45:in `set_global_stats': undefined method `[]' for nil:NilClass (NoMethodError)]
metric.enabled = false if( name == :stats )
# metric_fu-Saikuro currently fails? rescue in run': undefined method `usage' for RDoc:Module (NoMethodError)`
metric.enabled = false if( name == :saikuro )
end # }}}
### Analysis tools
config.configure_metric( :flog ) do |flog| # {{{
flog.enabled = true
flog.dirs_to_flog( paths )
puts "(--) Flog -> Passing following opts (#{flog.configured_run_options.to_s})"
end # }}}
config.configure_metric( :flay ) do |flay| # {{{
flay.enabled = true
flay.dirs_to_flay( paths )
puts "(--) Flay -> Passing following opts (#{flay.configured_run_options.to_s})"
end # }}}
config.configure_metric( :cane ) do |cane| # {{{
cane.enabled = true
cane.dirs_to_cane( paths )
cane.line_length = 110
cane.configured_run_options[ :dirs_to_cane ] = paths
puts "(--) Cane -> Passing following opts (#{cane.configured_run_options.to_s})"
end # }}}
config.configure_metric( :reek ) do |reek| # {{{
reek.enabled = true
reek.dirs_to_reek( paths )
puts "(--) Reek -> Passing following opts (#{reek.configured_run_options.to_s})"
end # }}}
config.configure_metric( :roodi ) do |roodi| # {{{
roodi.enabled = true
roodi.dirs_to_roodi( paths )
puts "(--) Roodi -> Passing following opts (#{roodi.configured_run_options.to_s})"
end # }}}
config.configure_metric( :churn ) do |churn| # {{{
churn.enable
churn.configured_run_options[ :dirs_to_churn ] = paths
puts "(--) Churn -> Passing following opts (#{churn.configured_run_options.to_s})"
end # }}}
config.configure_metric( :rcov ) do |rcov| # {{{
file = "tmp/coverage.log"
coverage_file = File.expand_path( file, Dir.pwd )
FileUtils.touch( coverage_file ) unless( File.exists?( coverage_file ) )
rcov.enabled = true
rcov.external = coverage_file
rcov.activate
rcov.configured_run_options[ :dirs_to_rcov ] = paths
puts "(--) RCov -> Passing following opts (#{rcov.configured_run_options.to_s})"
end # }}}
config.configure_metric( :saikuro ) do |saikuro| # {{{
saikuro.enabled = true
saikuro.configured_run_options[ :dirs_to_saikuro ] = paths
puts "(--) Saikuro -> Passing following opts (#{saikuro.configured_run_options.to_s})"
end # }}}
end # of MetricFu::Configuration.run do |config|
# vim:ts=2:tw=100:wm=100:syntax=ruby