Skip to content
Henrik edited this page Aug 21, 2014 · 1 revision

Run NChurn on your repository. This task can be beneficial to use in addition to your code health reporting, whether it is coverage, tests and so on.

desc "Check the churn on this repository"
nchurn :churn do |cmd|
  cmd.command = "path/to/nchurn"
  cmd.input = "path/to/input"
  cmd.output = "path/to/output"
  cmd.from = (DateTime.now - 3) #=> 3 days ago
  cmd.churn = 4
  cmd.top = 10
  cmd.report_as = :xml
  cmd.env_paths = ["some/bin/path"]
  cmd.adapter = :git
  cmd.exclude = "exe"
  cmd.include = "foo"
end

Required Parameters

Command

The location of the nchurn command line application.

command = "path/to/nchurn"

Optional Parameters

Input & Adapter

Get input from a file instead of a revision system query.

input = "path/to/input"

You should specify the correct revision system: :auto (default), :tfs, :svn, :git, :hg.

adapter = :git

Output & Report As

Output to the specified file in one of the supported styles: :table (default), :xml, :csv.

report_as = :xml
output = "path/to/output"

From

Past date to calculate churn (we will format a proper Ruby DateTime).

from = (DateTime.now - 3) #=> 3 days ago

Churn OR Churn Percent

Minimal churn or a churn percentage, but not both, please.

churn = 4
churn_precent = 30

Top

Return this number of records.

top = 10

Env Paths

Add these paths to your environment's PATH, to access tools, like svn.exe.

env_paths = ["some/bin/path"]

Exclude & Include

Exclude and/or include resources using these wildcards or regexps.

exclude = "exe"
include = "foo"

Guidance

Reporting for CI

Typically, under CI, you would want to use XML reporting with an XSLT, either one of your own or one provided.

report_as = :xml
output = "path/to/output"
Clone this wiki locally