Documentation

Want to modify style rules to better suit your preferences? Below you will find documentation on configuring style rules for each linter that we support.

If this page doesn't help you find what you are looking for, please tweet at us @houndci or email us at hound@thoughtbot.com and we will help you out.

Hound Configuration

The following linters are enabled by default:

  • RuboCop (Ruby)
  • CoffeeLint (CoffeeScript)
  • JavaScript (JSHint)
  • SCSS (SCSS-Lint)
  • Haml (HAMLLint)
  • Go (golint)
  • Swift (SwiftLint)

All other linters must be explicitly enabled.

Hound will look for a custom configuration file named .hound.yml in the root directory of your project.

Using .hound.yml you can tell Hound which linters to enable or disable, specify paths to files that provide custom style rules, and determine which files/directories to ignore. Here is an example:

scss: enabled: false ruby: config_file: .rubocop.yml jshint: ignore_file: .jshintignore

In this example, review of SCSS is deactivated, custom RuboCop configuration is provided for Ruby files, and an ignore file is given that tells which files/directories JSHint should not review.

Hound can be configured to use GitHub's Status API to mark a pull request as failed if any violations are found. To do so, add the following to your .hound.yml

fail_on_violations: true

Ruby

Hound uses RuboCop to review Ruby code.

By default, Hound uses the default RuboCop config. To change the way RuboCop is configured, add a .rubocop.yml file to your project, configure it as desired (see the RuboCop docs), and reference it in .hound.yml ruby: config_file: .rubocop.yml

To disable Ruby style checking, add the following to your .hound.yml ruby: enabled: false

CoffeeScript

Hound uses CoffeeLint with the default configuration.

To change the way CoffeeLint is configured, add a config file to your project and reference it in your .hound.yml coffeescript: config_file: coffeelint.json

To disable CoffeeScript style checking, add the following to your .hound.yml coffeescript: enabled: false

JavaScript

Hound uses JSHint to review JavaScript code by default.

To change the way JSHint is configured, add .jshintrc file to your project, specify your desired configuration and reference the file in your .hound.yml

jshint: config_file: .jshintrc

Check out JSHint configuration for supported options.

To ignore certain files and directories, add .jshintignore file to your project, include in it path patterns for files/directories that you want ignored, and reference the ignore file in your .hound.yml file. See linter docs for more info ("Ignoring Files" section). jshint: ignore_file: .javascript_ignore

To disable JavaScript style checking, add the following to your .hound.yml file. jshint: enabled: false

SCSS-Lint

Hound uses SCSS-Lint with this config by default.

To change the way SCSS-Lint is configured, simply copy the default config file into your project, make changes and reference the file in your .hound.yml

scss: config_file: .scss-lint.yml

To ignore certain SCSS files, add exclude: directive to your .scss-lint.yml file, like: exclude: - "app/assets/stylesheets/plugins/**"

To disable SCSS style checking, add the following to your .hound.yml scss: enabled: false

Haml

Hound uses haml-lint with this config by default.

To change the way haml-lint is configured, simply copy the default config file into your project, make changes and reference the file in your .hound.yml

haml: config_file: .haml-lint.yml

To disable Haml style checking, add the following to your .hound.yml haml: enabled: false

Go

Hound uses Golint to review Go code.

To disable Go style checking, add the following to your .hound.yml go: enabled: false

Swift

Hound uses SwiftLint with this config by default.

To change the way SwiftLint is configured, copy the default config file into your project, make changes and reference the file in your .hound.yml

swift: config_file: .swiftlint.yml

To disable Swift style checking, add the following to your .hound.yml file. swift: enabled: false

For more information on the available configuration in your config_file , you can read about it on the SwiftLint Configuration Documentation

ESLint

Hound uses ESLint with this config by default.

To enable ESLint style checking, add the following to your .hound.yml eslint: enabled: true

To change the way ESLint is configured, add .eslintrc file to your project, specify your desired configuration and reference the file in your .hound.yml

eslint: enabled: true config_file: .eslintrc

For more information on configuring ESLint rules, see the ESLint Rules Documentation

To ignore certain files and directories, add .eslintignore file to your project, include in it path patterns for files/directories that you want ignored, and reference the ignore file in your .hound.yml . See linter docs for more info. eslint: ignore_file: .eslintignore

Python

Hound uses Flake8 with this default config by default.

To enable Python style checking, add the following to your .hound.yml python: enabled: true

To change the way Flake8 is configured, create a .ini file with your custom configuration and reference the file in .hound.yml

python: enabled: true config_file: .flake8.ini

TSLint

Hound uses TSLint to review TypeScript code.

To enable TypeScript style checking, add the following to your .hound.yml tslint: enabled: true

To change the way TSLint is configured, add a tslint.json file to your project, configure it as desired (see the TSLint rules), and reference it in .hound.yml tslint: config_file: tslint.json

Elixir

Hound uses Credo to review Elixir code.

To enable Elixir style checking, add the following to your .hound.yml elixir: enabled: true

By default, Hound uses the Credo's Elixir Style Guide. To change the way Credo is configured, add a .credo.exs file to your project, configure it as desired (see the Credo docs), and reference it in .hound.yml elixir: enabled: true config_file: .credo.exs

Sass Lint

Hound uses Sass Lint with this config by default.

To enable Sass Lint style checking, add the following to your .hound.yml sass-lint: enabled: true

To change the way Sass Lint is configured, add .sass-lint.yml file to your project, specify your desired configuration and refreence the file in your .hound.yml

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