Configuration

Hound reads a .hound.yml file in the root of your repo to decide which linters to run and how to configure them. Questions about billing or access? See the FAQ.

.hound.yml

These linters are enabled by default:

  • RuboCop (Ruby)
  • CoffeeLint (CoffeeScript)
  • JSHint (JavaScript)
  • SCSS-Lint (SCSS)
  • haml-lint (Haml)
  • Golint (Go)
  • SwiftLint (Swift)

All other linters must be enabled. Each linter can point at its own config file, and some accept an ignore file. For example:

scss:
  enabled: false

rubocop:
  config_file: .rubocop.yml

jshint:
  ignore_file: .jshintignore

This turns off SCSS review, uses a custom RuboCop config for Ruby, and tells JSHint to skip the files listed in .jshintignore.

Fail the build

Hound can mark a pull request's status as failed when it finds any issues. Add this to your .hound.yml:

fail_on_violations: true

Shared organization-wide configuration

Repos in the same GitHub organization can share one Hound and linter configuration. Set up Hound and your linters in a single repo as usual, then on houndci.com/repos turn on the organization-wide config toggle and choose that repo.

Your other repos inherit that configuration and can still override linter rules in their own .hound.yml.

To stop a repo from using the shared configuration, add this to its own .hound.yml:

use_org_config: false

Hound reads the shared configuration from that repo's default branch, and a branch can add or change settings but not remove ones the shared configuration defines. So to test a linter upgrade that renames or removes rules, set use_org_config: false on the branch, and remove it before merging if the repo should keep using the shared configuration.

Linter versions

Some linters can run a specific version. Set it in .hound.yml:

rubocop:
  version: 1.22.1

eslint:
  version: 8.1.0

scss-lint:
  version: 0.57.1

Supported versions (the default is listed first):

  • RuboCop: 0.54.0, 0.59.2, 0.63.0, 0.64.0, 0.68.0, 0.71.0, 0.72.0, 0.75.0, 0.80.0, 0.83.0, 0.88.0, 0.91.0, 1.5.2, 1.22.1
  • ESLint: 4.19.1, 5.7.0, 5.16.0, 6.3.0, 6.8.0, 7.7.0, 8.1.0
  • SCSS-Lint: 0.50.2, 0.57.1
  • Stylelint: 10.1.0, 13.2.1

Other linters run a single version: Reek 5.0.2, Flog 4.6.2, JSHint 2.9.5, TSLint 5.9.1, Flake8 3.6.0, Credo 0.9.3, SwiftLint 0.43.1, CoffeeLint 1.16.2, Sass Lint 1.12.1, haml-lint 0.37.0, Slim-Lint 0.15.0, ShellCheck 0.5.0, remark 6.0.2 and ERB Lint 0.0.29. Hound doesn't support custom linters or custom rules.

Linters

RuboCop (Ruby)

Enabled by default, using RuboCop's default config. To customize it, add a .rubocop.yml to your repo:

rubocop:
  config_file: .rubocop.yml

To turn it off:

rubocop:
  enabled: false

Reek (Ruby code smells)

Uses Reek's default config. To enable it, optionally with your own .reek file:

reek:
  enabled: true
  config_file: .reek

Flog (Ruby complexity)

To enable Flog:

flog:
  enabled: true

ERB Lint

Uses erb-lint's built-in config. To enable it, optionally with your own config file:

erblint:
  enabled: true
  config_file: .erb-lint.yml

haml-lint (Haml)

Enabled by default. To customize haml-lint, add a config file to your repo:

haml:
  config_file: .haml-lint.yml

To turn it off:

haml:
  enabled: false

Slim-Lint (Slim)

To enable Slim-Lint:

slim_lint:
  enabled: true

ESLint (JavaScript)

To enable ESLint with your own .eslintrc (JSON or YAML only, since Hound merges configs):

eslint:
  enabled: true
  config_file: .eslintrc

To skip files and directories, list their path patterns in an .eslintignore file:

eslint:
  ignore_file: .eslintignore

JSHint (JavaScript)

Enabled by default. To customize JSHint or skip files:

jshint:
  config_file: .jshintrc
  ignore_file: .jshintignore

To turn it off:

jshint:
  enabled: false

TSLint (TypeScript)

To enable TSLint, optionally with your own tslint.json:

tslint:
  enabled: true
  config_file: tslint.json

CoffeeLint (CoffeeScript)

Enabled by default. To customize or turn off CoffeeLint:

coffeescript:
  config_file: coffeelint.json

# or
coffeescript:
  enabled: false

SCSS-Lint (SCSS)

Enabled by default. To customize SCSS-Lint, copy the default config into your repo, change it, and reference it:

scss:
  config_file: .scss-lint.yml

To skip files, add an exclude list to that config file:

exclude:
  - "app/assets/stylesheets/plugins/**"

To turn it off:

scss:
  enabled: false

Sass Lint (Sass)

To enable Sass Lint, optionally with your own .sass-lint.yml:

sass-lint:
  enabled: true
  config_file: .sass-lint.yml

Stylelint (CSS)

To enable Stylelint:

stylelint:
  enabled: true

Golint (Go)

Enabled by default. To turn off Golint:

golint:
  enabled: false

SwiftLint (Swift)

Enabled by default. To customize SwiftLint or turn it off:

swiftlint:
  config_file: .swiftlint.yml

# or
swiftlint:
  enabled: false

Flake8 (Python)

To enable Flake8, optionally with your own .ini-style config file:

flake8:
  enabled: true
  config_file: .flake8

In that file, separate each entry in the exclude list with a comma.

Credo (Elixir)

To enable Credo, optionally with your own .credo.exs:

credo:
  enabled: true
  config_file: .credo.exs

PHP_CodeSniffer (PHP)

To enable PHP_CodeSniffer:

phpcs:
  enabled: true

ShellCheck (shell scripts)

To enable ShellCheck, optionally with a config file listing codes to ignore:

shellcheck:
  enabled: true
  config_file: .shellcheck.yml

Example .shellcheck.yml:

exclude:
  - SC2034
  - SC2086

remark (Markdown)

To enable remark:

remark:
  enabled: true