Continuous Delivery - Part 2: Code metrics with metrical

leena

July 31, 2011

Metrical is for easier metric_fu setup. You can see the details on why and how here. Its an awesome tool which allows us to easily use metric_fu without adding any dependency to the project code.

The steps I followed for setting it up in our Jenkins server are:

As I mentioned above, tools such as flay and flog, which comes as part of metric_fu, have issues working with ruby 1.9.2. And the same case with stats graph and syntax highlighting. The same case with rcov also. So I had to create a metrics file with the following contents and put in the project dir:

MetricFu::Configuration.run do |config| config.code_dirs = ['app', 'lib'] config.syntax_highlighting = false config.metrics = [:churn,:reek,:roodi,:hotspots,:rails_best_practices] config.graphs = [:reek, :roodi, :rails_best_practices] config.rcov[:test_files] = ['spec/**/* _spec.rb'] config.rcov[:rcov_opts] << "-Ispec" # Needed to find spec_helper end

For test coverage I’ve used Simplecov which is easy to setup. It will generate the coverage report whenever you run the tests. This also generated html report which can be integrated easily into Jenkins. As mentioned here in the issue list, it does not generate the report when you are running with spork.

Continued..