Build Status Coverage Status

Quality -- code quality ratchet for Ruby

Overview

Quality is a tool that runs quality checks on Ruby code using cane, reek, flog, flay and rubocop and makes sure your numbers don't get any worse over time.

$ gem install quality

or in your Gemfile:

group :development do
  gem 'quality'
end

and then:

$ bundle install

Once you have the gem, configure your Rakefile like this:

require 'quality/rake/task'

Quality::Rake::Task.new

Then run:

$ rake quality

If you want to ratchet up the quality and force yourself to improve code, run:

$ rake ratchet

Configuration options

Quality::Rake::Task.new { |t|
  # Name of quality task.
  # Defaults to :quality.
  t.quality_name = "quality"

  # Name of ratchet task.
  # Defaults to :ratchet.
  t.ratchet_name = "ratchet"

  # Array of strings describing tools to be skipped--e.g., ["cane"]
  #
  # Defaults to []
  t.skip_tools = []

  # Log command executation
  #
  # Defaults to false
  t.verbose = false

  # Array of directory names which contain ruby files to analyze.
  #
  # Defaults to %w(app lib test spec feature), which translates to *.rb in the base directory, as well as those directories.
  t.ruby_dirs = %w(app lib test spec feature)

  # Array of directory names which contain any type of source files to analyze.
  #
  # Defaults to t.ruby_dirs
  t.source_dirs.concat(%w(MyProject MyProjectTests))

  # Pick any extra files that are source files, but may not have
  # extensions--defaults to ['Rakefile']
  t.extra_files = ['Foo', 'Rakefile']

  # Relative path to output directory where *_high_water_mark
  # files will be read/written
  #
  # Defaults to 'metrics'
  t.output_dir = 'metrics'

  # Pipe-separated regexp string describing what to look for in
  # files as 'todo'-like 'punchlist' comments.
  #
  # Defaults to 'XXX|TODO'
  t.punchlist_regexp = 'XXX|TODO'
}

Why

See this post for more information on the problem the quality gem solves.

Maturity

Quality uses semantic versioning--any incompatible changes will come out as major number updates.

Supported Ruby Versions

Tested against Ruby 1.9.3 and 2.1.2. Feel free to submit issues if problems are found elsewhere.

Contributing

  • Fork the repo
  • Create a feature branch
  • Submit a github pull request

Many thanks to all contributors, especially @andyw8, who has contributed some great improvements.

Dependencies

Quality makes use of the following other gems, which do the actual checking:

Learn More

License

Licensed under the MIT license.