Skip to content
This repository has been archived by the owner. It is now read-only.
⚠️ Deprecated - Configures various linters to comply with GOV.UK's style guides
Ruby
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
configs
lib/govuk
spec
.gitignore
.rspec
.ruby-version
CHANGELOG.md
Gemfile
Jenkinsfile
LICENSE.md
README.md
Rakefile
govuk-lint.gemspec

README.md

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.

You can’t perform that action at this time.