A formatter for RuboCop that outputs in checkstyle format. It requires RuboCop version 1.20.0 or above.
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
$ rubocop --require rubocop/formatter/checkstyle_formatter --format RuboCop::Formatter::CheckstyleFormatter
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".
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.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request