Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updating documentation

  • Loading branch information...
commit 1a9fcb8e552ad1499f75b94c2021a3d5a4ba5f0d 1 parent 4cf4eff
@jscruggs jscruggs authored
Showing with 63 additions and 298 deletions.
  1. +1 −154 README
  2. +62 −144 home_page/index.html
View
155 README
@@ -1,154 +1 @@
-Version 0.9.0
-http://github.com/jscruggs/metric_fu
-
-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.
-
-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.
-
-****Installation****
-sudo gem install jscruggs-metric_fu -s http://gems.github.com
-
-Then in your Rakefile:
-require 'metric_fu'
-
-If you like to vendor gems, you can unpack metric_fu into vendor/gems and require it like so:
-require 'vendor/gems/jscruggs-metric_fu-0.9.0/lib/metric_fu'
-
-then you don't have to install it on every box you run it on.
-
-Important note:
-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.
-
-
-****Usage****
-
-Out of the box metrics provides these tasks:
-rake metrics:all # Generate coverage, cyclomatic complexity, flog, flay, railroad and churn reports
-rake metrics:churn # Which files change the most
-rake metrics:coverage # Generate and open coverage report
-rake metrics:coverage:clean # Delete aggregate coverage data.
-rake metrics:coverage:clobber_do # Remove rcov products for do
-rake metrics:coverage:do # RCov task to generate report
-rake metrics:flay # Generate code duplication report with flay
-rake metrics:flog:all # Generate and open flog report
-rake metrics:flog:clean # Delete aggregate flog data.
-rake metrics:flog:controllers # Flog code in app/controllers
-rake metrics:flog:custom # Generate a flog report from specified directories
-rake metrics:flog:helpers # Flog code in app/helpers
-rake metrics:flog:lib # Flog code in lib
-rake metrics:flog:models # Flog code in app/models
-rake metrics:reek # A code smell report using Reek
-rake metrics:saikuro # A cyclomatic complexity report using Saikuro
-
-Rails projects also have the following tasks:
-
-rake metrics:stats # A stats report
-
-See below for more detail on the individual tasks. It's recommended to use 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:
-
-project.rake_task = 'metrics:all_with_migrate'
-project.scheduler.polling_interval = 24.hours
-
-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.
-
-
-****Notes on configuration****
-
-Metric_fu can be customized to your liking by adding the following to your Rakefile
-
-MetricFu::Configuration.run do |config|
- #define which metrics you want to use
- config.metrics = [:coverage, :flog]
- config.churn = { :start_date => lambda{ 3.months.ago } }
- config.coverage = { :test_files => ['test/**/test_*.rb'] }
- config.flog = { :dirs_to_flog => ['cms/app', 'cms/lib'] }
- config.flay = { :dirs_to_flay => ['cms/app', 'cms/lib'] }
- config.saikuro = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
-end
-
-
-****Notes on metrics:coverage****
-
-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 the coverage test files pattern:
- config.coverage[:test_files] = ['test/**/test_*.rb']
-
-The default value is ['test/**/*_test.rb', 'spec/**/*_spec.rb']
-
-You may also configure Rcov options:
- config.coverage = { :test_files => ['test/**/*_test.rb'],
- :rcov_opts => ["--exclude /gems/,/Library/"] }
-
-The default value is { :test_files => ['test/**/*_test.rb', 'spec/**/*_spec.rb'],
- :rcov_opts => ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/,spec"] }
-
-
-****Notes on metrics:saikuro****
-
-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 configuration:
-
- config.saikuro = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
-
-config.saikuro 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.
-
-If you want to have Saikuro look at multiple folders you can put something like this in your configuration:
-
- config.saikuro = {"--input_directory" => '"cms/app | cms/lib"'}
-
-
-****Notes on metrics:flay****
-
-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.
-
- config.flay[:dirs_to_flay] = ['cms/app', 'cms/lib']
-
-
-****Notes on metrics:flog****
-
-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.
-'rake metrics:flog:custom' allows you to specify a custom set of directories to Flog (in your configuration).
-The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
-
- config.flog[:dirs_to_flog] = ['cms/app', 'cms/lib']
-
-
-****Notes on metrics:reek****
-
-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.
-
- config.reek[:dirs_to_reek] = ['cms/app', 'cms/lib']
-
-
-****Notes on metrics:roodi****
-
-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.
-
- config.roodi[:dirs_to_roodi] = ['cms/app', 'cms/lib']
-
-****Notes on metrics:stats****
-
-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.
-
-
-****Notes on metrics:churn****
-
-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:
-
- config.churn = { :start_date => lambda{ 3.months.ago } }
-
-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.
-
-You can also change the minimum churn count like so:
-
- config.churn = { :minimum_churn_count => 3 }
-
-
-****Thanks****
-
-I'd like to thank the authors of Saikuro, Flog, Rcov, CruiseControl.rb, Flay, Reek, Roodi and Rails for creating such excellent open source products. Also Andre Arko, Petrik de Heus, Sean Soper, Erik St Martin, Andy Gregorowicz, Bastien, Michael Schubert, Kurtis Seebaldt, Toby Tripp, Paul Gross, and Chirdeep Shetty for their help and advice.
+See http://metric-fu.rubyforge.org/ for documentation, or the HISTORY file for a change log.
View
206 home_page/index.html
@@ -27,22 +27,18 @@
<li>
<h2>Links</h2>
<ul>
- <li><a href="http://rubyforge.org/projects/metric-fu/">
- Summary
- </a>
- </li>
- <li><a href="http://rubyforge.org/forum/?group_id=6142">
- Forums
- </a>
- </li>
- <li><a href="http://rubyforge.org/tracker/?group_id=6142">
- Tracker
+ <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>
@@ -50,7 +46,7 @@
<!-- end #sidebar -->
</div>
<div id="left">
- <h1>About metric_fu 0.9.0</h1>
+ <h1>About metric_fu 1.0.0</h1>
<div>
<p><br/>
Metric_fu is a set of rake tasks that make it easy to generate metrics reports. It uses
@@ -68,51 +64,15 @@
by placing files in the Custom Build Artifacts folder.
</p>
<br/>
-
-<p><br/>
- <h2>Output:</h2>
- <a href="cc.rb.gif">
- <img width="300" height="200" src="cc.rb.gif"
- alt="cruise control"/>
- </a>
- <a href="churn.gif">
- <img width="240" height="133" src="churn.gif"
- alt="churn"/>
- </a>
- <a href="flog.gif">
- <img width="322" height="110" src="flog.gif"
- alt="flog"/>
- </a>
- <a href="cyclomatic.gif">
- <img width="225" height="102" src="cyclomatic.gif"
- alt="cyclomatic"/>
- </a>
- <br/>
- <a href="flay.gif">
- <img width="326" height="115" src="flay.gif"
- alt="flay"/>
- </a>
- <br/>
- <a href="rcov.gif">
- <img width="322" height="100" src="rcov.gif"
- alt="rcov"/>
- </a>
- <a href="stats.gif">
- <img width="322" height="100" src="stats.gif"
- alt="stats"/>
- </a>
- <a href="roodi.gif">
- <img width="322" height="122" src="roodi.gif"
- alt="Roodi"/>
- </a>
- <a href="reek.gif">
- <img width="395" height="140" src="reek.gif"
- alt="Reek"/>
- </a>
-</p>
+<p>
+ The big new feature in metric_fu 1.0.0 is yaml serialization of the metrics. Running metric_fu now generates, in addition to html reports, a report.yml file. You can consume this file to mash up metrics, track them, or whatever you desire. Many thanks go to <a href="http://github.com/gmcinnes">Grant McInnes</a> for his work on this feature.
+</p>
<h2>Installation:</h2>
-<p>First do this:</p>
-<pre>sudo gem install jscruggs-metric_fu -s http://gems.github.com/</pre>
+<p>If you haven't added github to your gem sources do this:</p>
+<pre>sudo gem sources -a http://gems.github.com</pre>
+<br/>
+<p>Now install the gem:</p>
+<pre>sudo gem install jscruggs-metric_fu</pre>
<br/>
<p>Then in your Rakefile:</p>
<br/>
@@ -122,25 +82,24 @@
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', 'jscruggs-metric_fu-0.9.0', 'lib', 'metric_fu'))</pre>
+<pre>require(File.join(RAILS_ROOT, 'vendor', 'gems', 'jscruggs-metric_fu-1.0.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 environment.rb file:</p>
<br/>
-<pre>config.gem 'jscruggs-metric_fu', :version => '0.9.0', :lib => 'metric_fu', :source => 'http://gems.github.com'</pre>
+<pre>config.gem 'jscruggs-metric_fu', :version => '1.0.0', :lib => 'metric_fu', :source => 'http://gems.github.com'</pre>
<br/>
-<p>And then issue these commands:</p>
+<p>And then issue this command:</p>
<br/>
<pre>
$ rake gems:install
- $ rake gems:unpack
</pre>
<br/>
-<p>That way Rails won't yell at you everytime you run a Rake task:</p>
+<p>That way Rails won't yell at you every time you run a Rake task:</p>
<br/>
<pre>
- config.gem: Unpacked gem jscruggs-metric_fu-0.9.0 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
+ config.gem: Unpacked gem jscruggs-metric_fu-1.0.0 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
</pre>
<br/>
<p>
@@ -149,49 +108,51 @@
<p><br/>
<h2>Usage:</h2>
- Out of the box metric_fu provides these tasks:
+ Out of the box metric_fu provides this tasks:
<ul>
- <li>rake metrics:all # Generate coverage, cyclomatic complexity, flog, flay, railroad, reek, roodi, stats... </li>
- <li>rake metrics:all_with_migrate # Generate metrics after migrating (for continuous integration) </li>
- <li>rake metrics:churn # Which files change the most </li>
- <li>rake metrics:flay # Generate code duplication report with flay </li>
- <li>rake metrics:flog:all # Generate and open flog report </li>
- <li>rake metrics:flog:clean # Delete aggregate flog data. </li>
- <li>rake metrics:flog:controllers # Flog code in app/controllers </li>
- <li>rake metrics:flog:custom # Generate a flog report from specified directories </li>
- <li>rake metrics:flog:helpers # Flog code in app/helpers </li>
- <li>rake metrics:flog:lib # Flog code in lib </li>
- <li>rake metrics:flog:models # Flog code in app/models </li>
- <li>rake metrics:reek # A code smell report using Reek </li>
- <li>rake metrics:roodi # A Ruby coding standards report using Roodi </li>
- <li>rake metrics:saikuro # A cyclomatic complexity report using Saikuro </li>
- <li>rake metrics:stats # A stats report </li>
+ <li>rake metrics:all # Generate coverage, cyclomatic complexity, flog, flay, railroad, reek, roodi, stats... </li>
</ul>
<br/>
- See below for more detail on the individual tasks. 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:
+ 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_with_migrate'</pre>
+ <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. Like so:
+ 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/>
-<a href="cc.rb.gif">
- <img width="300" height="200" src="cc.rb.gif"
- alt="cruise control"/>
-</a>
-<p><br/>
- <h2>General notes on configuration:</h2>
- <p>Metric_fu can be customized to your liking by adding the following to your Rakefile:</p>
+
+ <h2>Configuration:</h2>
+ <p>You need to run the Configuration in your rakefile in order for metric_fu to work. If you just want to accept the defaults do this:</p>
+ <pre>
+ MetricFu::Configuration.run {}
+ </pre>
+ <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 = [:coverage, :flog]
- config.churn = { :start_date => lambda{ 3.months.ago } }
- config.coverage = { :test_files => ['test/**/test_*.rb'] }
- config.flog = { :dirs_to_flog => ['cms/app', 'cms/lib'] }
- config.flay = { :dirs_to_flay => ['cms/app', 'cms/lib'] }
- config.saikuro = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
+ MetricFu::Configuration.run do |config|
+ #define which metrics you want to use
+ config.metrics = [:churn, :saikuro, :stats, :flog, :flay, :reek, :roodi, :rcov]
+ config.flay = { :dirs_to_flay => ['app', 'lib'] }
+ 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 = { :test_files => ['test/**/*_test.rb',
+ 'spec/**/*_spec.rb'],
+ :rcov_opts => ["--sort coverage",
+ "--no-html",
+ "--text-coverage",
+ "--no-color",
+ "--profile",
+ "--rails",
+ "--exclude /gems/,/Library/,spec"]}
end
</pre>
</p>
@@ -202,92 +163,49 @@
</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. If you wish to change the options Saikuro is run with, then set it like so in your Rakefile:
+ 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/>
-<pre>
- config.saikuro = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
-</pre>
-<br/>
- MetricFu::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.
- <br/>
- <br/>
- If you want to have Saikuro look at multiple folders you can put something like this in you rakefile:
- <br/>
- <br/>
-<pre>
- config.saikuro = {"--input_directory" => '"cms/app | cms/lib"'}
-</pre>
</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.
- You can customize the directories analyzed like so:
</p>
-<pre>
- config.flay[:dirs_to_flay] = ['cms/app', 'cms/lib']
-</pre>
<p><br/>
<h2>Notes on metrics:flog</h2>
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/>
- 'rake metrics:flog:custom' allows you to specify a custom set of directories to Flog (in your rakefile) like so:
- <br/>
- <br/>
-<pre>
- config.flog[:dirs_to_flog] = ['cms/app', 'cms/lib']
-</pre>
-</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.
- You can customize the directories analyzed like so:
</p>
-<pre>
- config.reek[:dirs_to_reek] = ['cms/app', 'cms/lib']]
-</pre>
+
<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.
- You can customize the directories analyzed like so:
</p>
-<pre>
- config.roodi[:dirs_to_roodi] = ['cms/app', 'cms/lib']
-</pre>
<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. 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:
-<br/><br/>
-<pre>
- config.churn = { :start_date => lambda{ 3.months.ago } }
-</pre>
+ 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/>
- The Proc is there because '3.months.ago' only works after the Rails Environment is loaded (and Rails extends Fixnum) which I didn't want to do every time you run a rake task.
-<br/>
-<br/>
- You can also change the minimum churn count like so:
-<br/>
-<br/>
-<pre>
- config.churn = { :minimum_churn_count => 3 }
-</pre>
<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>,
Please sign in to comment.
Something went wrong with that request. Please try again.