Skip to main content
Table of contents

Patterns & Style Guides

Lint your Ruby code

To lint Ruby code we recommend using Rubocop. It 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.

The rubocop-govuk gem is a set of Rubocop style rules to enforce consistency with the GOV.UK style guide. See the readme for details on installation and usage.

Jenkins builds

The default Jenkins build script will detect if you are using rubocop and will run it automatically.

This page was last reviewed on 2 July 2019. It needs to be reviewed again on 2 January 2020 by the page owner #govuk-developers .
This page was set to be reviewed before 2 January 2020 by the page owner #govuk-developers. This might mean the content is out of date.