Lint your Ruby code with govuk-lint
The govuk-lint gem uses Rubocop to enforce consistency with the GOV.UK style guide.
Rubocop is an open-source gem that performs static analysis of Ruby code according to rules that can be granularly configured. Each validation, or rule, is called a “cop”. Some of those cops come with the ability to auto-correct issues.
How to use govuk-lint
govuk-lintto your Gemfile
govuk-lint-rubyin your project root folder
If you have an existing Ruby project that has a number of violations of the GOV.UK style guide, a way of addressing those issues is:
govuk-lint-ruby --auto-correctin your project root folder, check that you are happy with those changes and commit.
- For the remainder of the violations, manually fix the issues before committing the code containing those fixes.
The default Jenkins build script will detect if you are using
govuk-lint and will run it automatically.