Clone this wiki locally
MetricFu is an aggregator of several static code analysis tools for Ruby. It displays code metrics from Flog, Flay, Saikuro, Churn, Reek, Roodi, Code Statistics, and Rails Best Practices (and optionally code coverage with RCov). With MetricFu, you get a combined HTML report of all the metrics.
See main github page for installation and usage instructions.
Changing warning thresholds
MetricFu works out of the box; however you may want to change thresholds for warnings generated by the static analysis tools. A common wish may be to change Cane warnings about line length from the default 80 characters to a longer length, if you are fine with your line overruns. This is a bit tricky with metric_fu 4.4.4 since the internal MetricFu settings do not directly correspond to Cane argument names.
.metrics file (expected to reside in your project root dir)
MetricFu::Configuration.run do |config| config.configure_metric(:cane) do |cane| cane.line_length = 110 end end
The correspondence between MetricFu and Cane parameters can be seen in cane.rb file -
def style_measure_param maps MetricFu's
line_length to Cane's
Setup filehandler to easily open project files in favourite editor
To open any of the files mentioned in metric_fu reports you could set a file handler ( file://, sublime://, ruby mine://
MetricFu::Configuration.run do |config| config.templates_configuration do |tc| tc.link_prefix = 'sublime:/' end end
Note: You may also need to configure your browser to handle the custom protocol. An example for Ubuntu, Firefox, and Sublime can be viewed here.
Integration with Jenkins
If you use Jenkins CI and wish to see MetricFu reports, the easiest way is to use HTML Publisher plugin. In Post-build Actions, choose "Publish HTML Reports", set HTML directory to
yourProjectName/tmp/metric_fu/output and index page to
index.html, and give your report a name - say "MetricFu Reports". Save configuration, run your build, and you should see "MetricFu Reports" link in the left sidebar.
- Cane code quality threshold checking is not included in the hotspots report