We're using the govuk-lint
Gem to include Rubocop and the GOV.UK styleguide rules in the project.
We run govuk-lint-ruby
as part of the test suite executed on Jenkins. Behind the scenes this runs Rubocop with a set of cops defined in the govuk-lint
gem.
Testing for violations in the entire codebase:
$ govuk-lint-ruby
Testing for violations in code committed locally that's not present in origin/master (useful to check code committed in a local branch):
$ govuk-lint-ruby --diff
Testing for violations in code staged and committed locally that's not present in origin/master:
$ govuk-lint-ruby --diff --cached