jscruggs-metric_fu 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +44 -20
- data/README +19 -24
- data/TODO.txt +7 -1
- data/lib/tasks/churn.rake +3 -2
- data/lib/tasks/coverage.rake +2 -2
- data/lib/tasks/saikuro.rake +2 -1
- data/metric_fu.gemspec +1 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== MetricFu 0.7.6 / 2008-09-15
|
2
|
+
|
3
|
+
* CHURN_OPTIONS has become MetricFu::CHURN_OPTIONS
|
4
|
+
* SAIKURO_OPTIONS has become MetricFu::SAIKURO_OPTIONS
|
5
|
+
* Rcov now looks at test and specs
|
6
|
+
* Exclude gems and Library ruby code from rcov
|
7
|
+
* Fixed bug with churn start_date functionality (bad path)
|
8
|
+
|
1
9
|
=== MetricFu 0.7.5 / 2008-09-12
|
2
10
|
|
3
11
|
* Flog can now flog any set of directories you like (see README).
|
@@ -12,36 +20,52 @@
|
|
12
20
|
* Merged in Sean Soper's changes to metric_fu.
|
13
21
|
* Metric_fu is now a gem.
|
14
22
|
* Flogging now uses a MD5 hash to figure out if it should re-flog a file (if it's changed)
|
15
|
-
*
|
23
|
+
* Flogging also has a cool new output screen(s)
|
16
24
|
* Thanks Sean!
|
17
25
|
|
18
|
-
=== Metricks 0.4.2 / 2008-07-01
|
26
|
+
=== Metricks 0.4.2 / 2008-07-01
|
27
|
+
|
28
|
+
* Changed rcov output directory so that it is no longer 'coverage/unit' but just 'coverage' for better integration with CC.rb
|
29
|
+
|
30
|
+
=== Metricks 0.4.1 / 2008-06-13
|
31
|
+
|
32
|
+
* Rcov tests now extend beyond one level depth directory by using RcovTask instead of the shell
|
33
|
+
|
34
|
+
=== Metricks 0.4.0 / 2008-06-13
|
35
|
+
|
36
|
+
* Implementing functionality for use as a gem
|
37
|
+
* Added Rakefile to facilitate testing
|
38
|
+
|
39
|
+
=== Metricks 0.3.0 / 2008-06-11
|
19
40
|
|
20
|
-
*
|
41
|
+
* Generated reports now open on darwin automatically
|
42
|
+
* Generated reports reside under tmp/metricks unless otherwise specified by ENV['CC_BUILD_ARTIFACTS']
|
43
|
+
* MD5Tracker works with Flog reports for speed optimization
|
21
44
|
|
22
|
-
=== Metricks 0.
|
45
|
+
=== Metricks 0.2.0 / 2008-06-11
|
23
46
|
|
24
|
-
*
|
47
|
+
* Integrated use of base directory constant
|
48
|
+
* Have all reports automatically open in a browser if platform is darwin
|
49
|
+
* Namespaced under Metricks
|
50
|
+
* Dropped use of shell md5 command in favor of Ruby's Digest::MD5 libraries
|
25
51
|
|
26
|
-
=== Metricks 0.
|
52
|
+
=== Metricks 0.1.0 / 2008-06-10
|
27
53
|
|
28
|
-
*
|
29
|
-
*
|
54
|
+
* Initial integration of metric_fu and my enhancements to flog
|
55
|
+
* Metrics are generated but are all over the place
|
30
56
|
|
31
|
-
===
|
57
|
+
=== MetricFu 0.6.0 / 2008-05-11
|
32
58
|
|
33
|
-
*
|
34
|
-
* Generated reports reside under tmp/metricks unless otherwise specified by ENV['CC_BUILD_ARTIFACTS']
|
35
|
-
* MD5Tracker works with Flog reports for speed optimization
|
59
|
+
* Add source control churn report
|
36
60
|
|
37
|
-
===
|
61
|
+
=== MetricFu 0.5.1 / 2008-04-25
|
38
62
|
|
39
|
-
*
|
40
|
-
* Have all reports automatically open in a browser if platform is darwin
|
41
|
-
* Namespaced under Metricks
|
42
|
-
* Dropped use of shell md5 command in favor of Ruby's Digest::MD5 libraries
|
63
|
+
* Fixed bug with Saikuro report generation
|
43
64
|
|
44
|
-
===
|
65
|
+
=== MetricFu 0.5.0 / 2008-04-25
|
45
66
|
|
46
|
-
*
|
47
|
-
*
|
67
|
+
* create MetricFu as a Rails Plugin
|
68
|
+
* Add Flog Report
|
69
|
+
* Add Coverage Report
|
70
|
+
* Add Saikuro Report
|
71
|
+
* Add Stats Report
|
data/README
CHANGED
@@ -1,27 +1,26 @@
|
|
1
|
-
Version 0.7.
|
1
|
+
Version 0.7.6
|
2
2
|
http://github.com/jscruggs/metric_fu
|
3
3
|
|
4
4
|
Metric_fu began its life as a plugin for Rails that generated code metrics reports. As of version 0.7.0, metric_fu is a gem owing to the excellent work done by Sean Soper.
|
5
5
|
|
6
6
|
Metric_fu is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Rcov, and Rails' built-in stats task to create a series of reports. It's designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder.
|
7
7
|
|
8
|
-
|
8
|
+
****Installation****
|
9
9
|
sudo gem install jscruggs-metric_fu -s http://gems.github.com
|
10
10
|
|
11
11
|
Then in your Rakefile:
|
12
12
|
require 'metric_fu'
|
13
13
|
|
14
14
|
If you like to vendor gems, you can unpack metric_fu into vendor/gems and require it like so:
|
15
|
-
require '
|
15
|
+
require 'vendor/gems/jscruggs-metric_fu-0.7.6/lib/metric_fu'
|
16
16
|
|
17
17
|
then you don't have to install it on every box you run it on.
|
18
18
|
|
19
|
-
|
20
|
-
*Important note:
|
19
|
+
Important note:
|
21
20
|
You must have Rcov and Flog installed to get coverage and flog reports. Metric_fu requires both of these gems so they will be installed when you install the metric_fu gem.
|
22
21
|
|
23
22
|
|
24
|
-
|
23
|
+
****Usage****
|
25
24
|
|
26
25
|
Out of the box metrics provides these tasks:
|
27
26
|
rake metrics:all
|
@@ -49,54 +48,50 @@ project.scheduler.polling_interval = 24.hours
|
|
49
48
|
Which will check for updates every 24 hours and run all the metrics rake tasks (migrating your test db first). The output will be visible from an individual build's detail page.
|
50
49
|
|
51
50
|
|
52
|
-
|
51
|
+
****Notes on metrics:coverage****
|
53
52
|
|
54
|
-
When creating a coverage report, metric_fu runs all the tests in the test folder
|
53
|
+
When creating a coverage report, metric_fu runs all the tests in the test folder and specs in spec folder using Rcov.
|
55
54
|
|
56
55
|
|
57
|
-
|
56
|
+
****Notes on metrics:saikuro****
|
58
57
|
|
59
58
|
Saikuro is bundled with metric_fu so you don't have to install it. Look at the SAIKURO_README (or the internet) for more documentation on Saikuro. If you wish to change the options Saikuro is run with, then set this constant in your Rakefile:
|
60
|
-
|
61
|
-
|
62
|
-
SAIKURO_OPTIONS = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
|
63
|
-
end
|
59
|
+
|
60
|
+
SAIKURO_OPTIONS = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
|
64
61
|
|
65
62
|
Like RCOV_OPTIONS, SAIKURO_OPTIONS is a hash that gets merged with the default options hash. The above example will set the warn_cyclo to 3 and the error_cyclo to 4 (which is way too low -- it's just an example) instructing Saikuro to flag methods with a higher cyclomatic complexity in it's report.
|
66
63
|
|
67
64
|
If you want to have Saikuro look at multiple folders you can put something like this in you rakefile:
|
68
|
-
SAIKURO_OPTIONS = {"--input_directory" => '"cms/app | cms/lib"'}
|
65
|
+
MetricFu::SAIKURO_OPTIONS = {"--input_directory" => '"cms/app | cms/lib"'}
|
69
66
|
|
70
67
|
|
71
|
-
|
68
|
+
****Notes on metrics:flog****
|
72
69
|
|
73
70
|
Flog is another way of measuring complexity (or tortured code as the Flog authors like to put it). You should check out the awesome, and a little scary, Flog website for more info.
|
74
71
|
|
75
72
|
'rake metrics:flog:custom' allows you to specify a custom set of directories to Flog (in your rakefile) like so:
|
73
|
+
|
76
74
|
MetricFu::DIRECTORIES_TO_FLOG = ['cms/app', 'cms/lib']
|
77
75
|
|
78
|
-
|
76
|
+
|
77
|
+
****Notes on metrics:stats****
|
79
78
|
|
80
79
|
This is just 'rake stats' for Rails put into a file. On my projects I like to be able to look at CruiseControl and get stats about the app at different points in time.
|
81
80
|
|
82
81
|
|
83
|
-
|
82
|
+
****Notes on metrics:churn****
|
84
83
|
|
85
84
|
Files that change a lot in your project may be bad a sign. This task uses "svn log" to identify those files and put them in a report. The default is to start counting changes from the beginning of your project, which might be too far back so you can change like so:
|
86
85
|
|
87
|
-
|
88
|
-
CHURN_OPTIONS = { :start_date => lambda{3.months.ago} }
|
89
|
-
end
|
86
|
+
MetricFu::CHURN_OPTIONS = { :start_date => lambda{3.months.ago} }
|
90
87
|
|
91
88
|
The Proc is there because '3.months.ago' only works when after the Rails Environment is loaded (and Rails extends Fixnum) which I didn't want to do every time you run a rake task.
|
92
89
|
|
93
90
|
You can also change the minimum churn count like so:
|
94
91
|
|
95
|
-
|
96
|
-
CHURN_OPTIONS = { :minimum_churn_count => 3 }
|
97
|
-
end
|
92
|
+
MetricFu::CHURN_OPTIONS = { :minimum_churn_count => 3 }
|
98
93
|
|
99
94
|
|
100
|
-
|
95
|
+
****Thanks****
|
101
96
|
|
102
97
|
I'd like to thank the authors of Saikuro, Flog, Rcov, CruiseControl.rb, and Rails for creating such excellent open source products. Also Sean Soper, Michael Schubert, Kurtis Seebaldt, Toby Tripp, Paul Gross, and Chirdeep Shetty for their help and advice.
|
data/TODO.txt
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
== TODO list
|
2
2
|
|
3
|
+
* Sort Flog scores from worst to best
|
4
|
+
* Get churn to work with git
|
5
|
+
* Extract functionality from rake files and put under test
|
6
|
+
* Change churn start_date to not rely on Rails 1.day.ago functionality (so metric_fu can be used in non-Rails apps)
|
7
|
+
* Make integration with RSpec better (use SpecTask?)
|
8
|
+
* Integrate Flog, Saikuro, and Coverage into one report so you can see methods that have high complexity and low coverage (this is a big one)
|
3
9
|
* Integrate MD5 hashing with remainder of reports
|
4
|
-
|
10
|
+
|
data/lib/tasks/churn.rake
CHANGED
@@ -16,9 +16,10 @@ namespace :metrics do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def churn_options
|
19
|
-
|
19
|
+
raise "CHURN_OPTIONS is now MetricFu::CHURN_OPTIONS" if defined?(CHURN_OPTIONS)
|
20
|
+
options = defined?(MetricFu::CHURN_OPTIONS) ? MetricFu::CHURN_OPTIONS : {}
|
20
21
|
if options[:start_date]
|
21
|
-
require
|
22
|
+
require RAILS_ROOT + '/config/environment'
|
22
23
|
date_range = "--revision {#{options[:start_date].call.strftime('%Y-%m-%d')}}:{#{Time.now.strftime('%Y-%m-%d')}}"
|
23
24
|
else
|
24
25
|
date_range = ""
|
data/lib/tasks/coverage.rake
CHANGED
@@ -18,8 +18,8 @@ begin
|
|
18
18
|
desc "RCov task to generate report"
|
19
19
|
Rcov::RcovTask.new(:do => :clean) do |t|
|
20
20
|
FileUtils.mkdir_p(MetricFu::BASE_DIRECTORY) unless File.directory?(MetricFu::BASE_DIRECTORY)
|
21
|
-
t.test_files = FileList['test/**/*_test.rb']
|
22
|
-
t.rcov_opts = ["--sort coverage", "--
|
21
|
+
t.test_files = FileList['test/**/*_test.rb', 'spec/**/*_spec.rb']
|
22
|
+
t.rcov_opts = ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/"]
|
23
23
|
t.output_dir = COVERAGE_DIR
|
24
24
|
end
|
25
25
|
end
|
data/lib/tasks/saikuro.rake
CHANGED
@@ -4,6 +4,7 @@ namespace :metrics do
|
|
4
4
|
|
5
5
|
desc "A cyclomatic complexity report using Saikuro"
|
6
6
|
task :saikuro do
|
7
|
+
raise "SAIKURO_OPTIONS is now MetricFu::SAIKURO_OPTIONS" if defined?(SAIKURO_OPTIONS)
|
7
8
|
default_options = {"--output_directory" => SAIKURO_DIR,
|
8
9
|
"--input_directory" => "app",
|
9
10
|
"--cyclo" => "",
|
@@ -11,7 +12,7 @@ namespace :metrics do
|
|
11
12
|
"--warn_cyclo" => "5",
|
12
13
|
"--error_cyclo" => "7"}
|
13
14
|
|
14
|
-
default_options.merge!(SAIKURO_OPTIONS) if defined?(SAIKURO_OPTIONS)
|
15
|
+
default_options.merge!(MetricFu::SAIKURO_OPTIONS) if defined?(MetricFu::SAIKURO_OPTIONS)
|
15
16
|
options = ""
|
16
17
|
default_options.each_pair { |key, value| options << "#{key} #{value} " }
|
17
18
|
|
data/metric_fu.gemspec
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "metric_fu"
|
3
|
-
s.version = "0.7.
|
4
|
-
s.date = "2008-09-12"
|
3
|
+
s.version = "0.7.6"
|
5
4
|
s.summary = "Generates project metrics using Flog, RCov, Saikuro and more"
|
6
5
|
s.email = "jake.scruggs@gmail.com"
|
7
6
|
s.homepage = "http://metric-fu.rubyforge.org/"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jscruggs-metric_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Scruggs
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-
|
13
|
+
date: 2008-08-13 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|