Project

govuk-lint

0.02
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Include this in your project to easily validate it against the GDS style guides
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.3

Runtime

 Project Readme

DEPRECATED

This repository and Gem has been deprecated and is no longer supported.

To lint Ruby and RSpec projects please consider using rubocop with rubocop-govuk.

To lint SASS projects please consider using scss-lint with scss-lint-govuk.

For guidance on upgrading to these tools see the migrate from govuk-lint page in the developer docs.

GOV.UK Lint

This repo configures various linters to comply with our style guides.

Supported languages

Puppet

We maintain a set of tasks for linting and sanity checks in the gds-operations/puppet-syntax repository.

Ruby

Linter: rubocop

To use, include govuk-lint in your Gemfile and run:

bundle exec govuk-lint-ruby <files and directories>

It's best to lint just your app directories and not those belonging to the framework, e.g.

bundle exec govuk-lint-ruby app lib spec

Useful options:

  • -a: Auto-correct violations if possible
  • -R: Also run Rails-specific cops
  • --diff: Only lint lines that have been changed in the current diff
  • --cached: Used with --diff to lint only lines changed between origin/master and HEAD.

See more options in the rubocop README.

RSpec

You can enable RSpec cops by adding the following line to the .rubocop.yml file in your project:

require: rubocop-rspec

Sass

Linter: scss-lint

To use, include govuk-lint in your Gemfile and run:

bundle exec govuk-lint-sass <directory or file>
bundle exec govuk-lint-sass app/assets/stylesheets

When linting your app any assets within vendor will be ignored by default.

Auto-correction and --diff mode are unavailable.