/
index.html
executable file
·277 lines (266 loc) · 12.6 KB
/
index.html
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>metric_fu: A Ruby Gem for Easy Metric Report Generation</title>
<meta name="keywords" content="metric_fu rails metrics saikuro flog flay roodi reek cyclomatic complexity rcov coverage gem" />
<meta name="description" content="Ruby Gem for Easy Metric Report Generation" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<!-- header begins -->
<div id="header">
<div id="logo"><a href="#">metric_fu</a></div>
<div id="buttons">
<ul><li>A Ruby Gem for Easy Metric Report Generation</li></ul>
</div>
</div>
<!-- header ends -->
<!-- content begins -->
<div id="content">
<div id="right">
<div id="sidebar">
<ul>
<li>
<h2>Links</h2>
<ul>
<li><a href="http://groups.google.com/group/metric_fu">
Google Group
</a>
</li>
<li><a href="http://github.com/jscruggs/metric_fu">
SCM
</a>
</li>
<li><a href="http://jakescruggs.blogspot.com/">
Jake Scruggs' Blog (lead developer)
</a>
</li>
</ul>
</li>
</ul>
</div>
<!-- end #sidebar -->
</div>
<div id="left">
<h1>About metric_fu 1.3.0</h1>
<div>
<p><br/>
Metric_fu is a set of rake tasks that make it easy to generate metrics reports. It uses
<a href="http://saikuro.rubyforge.org/">Saikuro</a>,
<a href="http://ruby.sadi.st/Flog.html">Flog</a>,
<a href="http://ruby.sadi.st/Flay.html">Flay</a>,
<a href="http://eigenclass.org/hiki.rb?rcov">Rcov</a>,
<a href="http://github.com/kevinrutherford/reek">Reek</a>,
<a href="http://github.com/martinjandrews/roodi">Roodi</a>,
<a href="http://github.com/danmayer/churn">Churn</a>,
<a href="http://subversion.tigris.org/">Subversion</a>,
<a href="http://git.or.cz/">Git</a>, and
<a href="http://www.rubyonrails.org/">Rails</a>
built-in stats task to create a series of reports. It's designed to integrate easily with
<a href="http://cruisecontrolrb.thoughtworks.com/">CruiseControl.rb</a>
by placing files in the Custom Build Artifacts folder.
</p>
<br/>
<p>
New in metric_fu 1.3.0 is the ability to configure what RAILS_ENV you what Rcov to run under so it won't clobber any other tests that might be running (in continuous integration). You can also configure the minimum Flay score to record (the default minimum score 100). There's now some cool tooltip hover info in the graphs (thanks Édouard Brière).
</p>
<br/>
<p>
In metric_fu 1.2.0 the graphing has been overhauled. Now you can use either Bluff (the default) or Google Charts to make your graphs. An upside of moving away from Gruff is that metric_fu no longer depends on ImageMagick/rmagick. Carl Youngblood submitted this feature so thank him if you like it. See the Graphing section below for how to configure.
</p>
<br/>
<h2>Installation:</h2>
<pre>sudo gem install metric_fu</pre>
<br/>
<p>Then in your Rakefile:</p>
<br/>
<pre>require 'metric_fu'</pre>
<br/>
<p>
If you like to vendor gems, you can unpack metric_fu into vendor/gems and require it like so:
</p>
<br/>
<pre>require(File.join(RAILS_ROOT, 'vendor', 'gems', 'metric_fu-1.3.0', 'lib', 'metric_fu'))</pre>
<br/>
<p>Then you don't have to install it on every box you run it on.</p>
<br/>
<p>Later versions of Rails like to manage your gems for you, so you can put this in your test.rb file:</p>
<br/>
<pre>config.gem 'metric_fu', :version => '1.3.0', :lib => 'metric_fu'</pre>
<br/>
<p>And then issue this command:</p>
<br/>
<pre>
$ rake gems:unpack RAILS_ENV=test
</pre>
<br/>
<p>That way Rails won't yell at you every time you run a Rake task:</p>
<br/>
<pre>
config.gem: Unpacked gem metric_fu-1.3.0 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
</pre>
<br/>
<p>
I hate being yelled at.
</p>
<h2>Output:</h2>
<table>
<tr>
<td><a href="flog.gif"><img src="flog.gif" width="250"></a></td>
<td><a href="flay.gif"><img src="flay.gif" width="250"></a></td>
<tr>
<td><a href="churn.gif"><img src="churn.gif" width="250"></a></td>
<td><a href="saikuro.gif"><img src="saikuro.gif" width="250"></a></td>
</tr>
<tr>
<td><a href="reek.gif"><img src="reek.gif" width="250"></a></td>
<td><a href="roodi.gif"><img src="roodi.gif" width="250"></a></td>
</tr>
<tr>
<td><a href="rcov.gif"><img src="rcov.gif" width="250"></a></td>
<td><a href="stats.gif"><img src="stats.gif" width="250"></a></td>
</tr>
</table>
<p><br/>
<h2>Usage:</h2>
Out of the box metric_fu provides this tasks:
<ul>
<li>rake metrics:all # Generate coverage, cyclomatic complexity, flog, flay, reek, roodi, stats... </li>
</ul>
<br/>
I recommend using CruiseControl.rb to set up a metrics build. See the CruiseControl.rb online docs for more info on how to set up cc.rb and, once you've got that figured out, change the cruise_config.rb file inside your project to have these lines:
<br/><br/>
<pre>project.rake_task = 'metrics:all'</pre>
<pre>project.scheduler.polling_interval = 24.hours</pre>
<br/>
Which will check for updates every 24 hours and run all the metric_fu rake tasks (migrating your test db first). The output will be visible from an individual build's detail page.
</p>
<br/>
<h2>Configuration:</h2>
<p>Metric_fu can be customized to your liking by altering the defaults in your Rakefile:</p>
<pre>
MetricFu::Configuration.run do |config|
#define which metrics you want to use
config.metrics = [:churn, :saikuro, :stats, :flog, :flay, :reek, :roodi, :rcov]
config.graphs = [:flog, :flay, :reek, :roodi, :rcov]
config.flay = { :dirs_to_flay => ['app', 'lib'],
:minimum_score => 100 }
config.flog = { :dirs_to_flog => ['app', 'lib'] }
config.reek = { :dirs_to_reek => ['app', 'lib'] }
config.roodi = { :dirs_to_roodi => ['app', 'lib'] }
config.saikuro = { :output_directory => 'scratch_directory/saikuro',
:input_directory => ['app', 'lib'],
:cyclo => "",
:filter_cyclo => "0",
:warn_cyclo => "5",
:error_cyclo => "7",
:formater => "text"} #this needs to be set to "text"
config.churn = { :start_date => "1 year ago", :minimum_churn_count => 10}
config.rcov = { :environment => 'test',
:test_files => ['test/**/*_test.rb',
'spec/**/*_spec.rb'],
:rcov_opts => ["--sort coverage",
"--no-html",
"--text-coverage",
"--no-color",
"--profile",
"--rails",
"--exclude /gems/,/Library/,spec"]}
config.graph_engine = :bluff
end
</pre>
Note: if you don't want one of the metrics to run (like rcov), make sure you don't try to graph it (which will explode). Set config.graphs to exactly the graphs you want. Set config.graphs to an empty array (config.graphs = []) if you want no graphing at all.
</p>
<p><br/>
<h2>Graphing</h2>
MetricFu uses Bluff for graphing (a Javascript library) by default. If you'd rather use Google Charts you can set 'config.graph_engine = :gchart' in the config. You'll have to install the googlecharts gem, of course.
</p>
<p><br/>
<h2>Notes on metrics:coverage</h2>
When creating a coverage report, metric_fu runs all the tests in the test folder and specs in spec folder using Rcov. You can configure what files it should run and the RAILS_ENV (by setting 'environment') it runs under. See the configuration section above for details.
</p>
<p><br/>
<h2>Notes on metrics:saikuro</h2>
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.
<br/><br/>
</p>
<p><br/>
<h2>Notes on metrics:flay</h2>
Flay analyzes ruby code for structural similarities.
You can configure which directories need to be flayed.
The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
By default, metric_fu ignores scores under 100. You can configure the minimum_score (see configuration section above).
</p>
<p><br/>
<h2>Notes on metrics:flog</h2>
Note: Flog 2.1.2 has some issues with Ruby 1.8.6 -- try using Flog 2.1.0 (Flog 2.1.2 does, however, work fine with Ruby 1.9.1)
<br/>
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, <a href="http://ruby.sadi.st/Flog.html">Flog website</a> for more info.
</p>
<p><br/>
<h2>Notes on metrics:reek</h2>
Reek detects common code smells in ruby code.
You can configure which directories need to be checked.
The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
</p>
<p><br/>
<h2>Notes on metrics:roodi</h2>
Roodi parses your Ruby code and warns you about design issues you have based on the checks that is has configured.
You can configure which directories need to be checked.
The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
</p>
<p><br/>
<h2>Notes on metrics:stats</h2>
This is just 'rake stats' 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.
</p>
<p><br/>
<h2>Notes on metrics:churn</h2>
Files that change a lot in your project may be bad a sign. This task uses svn or git's log to identify those files and put them in a report.
<br/>
<br/>
</p>
<br/>
<p>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) and is hosted on GitHub at <a href="http://github.com/jscruggs/metric_fu">http://github.com/jscruggs/metric_fu</a>. </p>
<p><br/>
<h2>Questions?</h2>
<p>Use the Google Group: <a href="http://groups.google.com/group/metric_fu">http://groups.google.com/group/metric_fu</a></p>
<br/>
<h2>Thanks</h2>
I'd like to thank the authors of Saikuro, Subversion, Flog, Rcov, CruiseControl.rb, and Rails for creating such excellent open source products. Also many thanks go to
<a href="http://arko.net/">Andre Arko</a>,
<a href="http://deheus.net/petrik">Petrik de Heus</a>,
<a href="http://seansoper.com/">Sean Soper</a>,
<a href="http://www.perilled.com/">Erik St Martin</a>,
<a href="http://gregorowicz.blogspot.com/">Andy Gregorowicz</a>,
<a href="http://github.com/bastien/">Bastien</a>,
<a href="http://schubert.cx/">Michael Schubert</a>,
<a href="http://kseebaldt.blogspot.com/">Kurtis Seebaldt</a>,
<a href="http://www.workingwithrails.com/person/11263-toby-tripp">Toby Tripp</a>,
<a href="http://www.aliaghareza.com">Ali Aghareza</a>,
<a href="http://www.pgrs.net/">Paul Gross</a>, and
<a href="http://chirdeepshetty.net/">Chirdeep Shetty</a>
for their contributions to metric_fu.
</p>
</div>
</div>
</div>
</div>
<!-- content ends -->
<!-- footer begins -->
<div id="metamorph2"><div id="footer">
<p>Copyright © 2008. Designed by <a href="http://www.metamorphozis.com/" title="Free Web Templates">Free Web Templates</a></p>
</div></div>
<!-- footer ends -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-1908573-3");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>