Low commit activity in last 3 years
There's a lot of open issues
A long-lived project that still receives updates
A formatter for rubocop that outputs in checkstyle format
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.5.0
~> 2.4.1
>= 2.2.10
>= 12.3.3
>= 0
>= 0

Runtime

>= 1.14.0
>= 0
 Project Readme

RuboCop Checkstyle Formatter

A formatter for RuboCop that outputs in checkstyle format. It requires RuboCop version 1.20.0 or above.

Build Status

Installation

Add this line to your application's Gemfile:

gem 'rubocop-checkstyle_formatter', require: false

And then execute:

$ bundle

Or install it yourself as:

$ gem install rubocop-checkstyle_formatter

Usage

$ rubocop --require rubocop/formatter/checkstyle_formatter --format RuboCop::Formatter::CheckstyleFormatter

Set RUBOCOP_CHECKSTYLE_FORMATTER_OUTPUT_EMPTY_RESULT=false to omit <file> elements for files without offenses. The value is case-insensitive; by default, and for all other values, those empty elements are included. When empty <file> elements are emitted, the formatter warns on stderr that this default will change in a future version. Set the variable to false now to omit them and suppress the warning.

I use this formatter in Jenkins with Checkstyle plugin. As a part of build, I execute rubocop as shell script like:

bundle exec rubocop --require rubocop/formatter/checkstyle_formatter --format RuboCop::Formatter::CheckstyleFormatter --no-color --rails --out tmp/checkstyle.xml

Then, after build, I add post-build action 'Publish Checkstyle analysis results' and configure Checkstyle results to "tmp/checkstyle.xml".

Known limitations

Offense messages are written into the message attribute via REXML, which escapes &, <, >, ', and " automatically, so these characters are safe to include in cop messages. Raw control characters (e.g. \x01), however, are illegal in XML 1.0 and will cause REXML to raise an error while writing the report.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request