0.01
No commit activity in last 3 years
No release in over 3 years
Matches your project config to give the same errors as HoundCi
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

~> 0.25
>= 0
 Project Readme

Gem Version Build Status

Hound::Tools

Tools and configuration to locally simulate HoundCi checks

Initial Setup

In your Gemfile:

group :development do
  gem 'hound-tools', '~> 0.0.4', require: false
end

Create customizable RuboCop + Hound setup:

$ bundle exec hound-tools init

(NOTE: this runs rubocop --auto-gen, so it will disable all the offenses.)

Add new files to repository

Add the files to the repository:

git add .hound       # default Hound style guide and your overrides
git add .rubocop.yml # Rubocop-only config
git add .hound.yml   # Hound general style-checking config
git add .rubocop_merged_for_hound.yml # auto-generated Hound-only config (without Hound defaults)

Customizing your Rubocop/Hound setup

You should only be interested in these files:

  • .rubocop_todo.yml, which can be updated with bundle exec rubocop --auto-gen and then edited
  • .hound/overrides.yml, where you can override Hound's default rules or excludes
  • .rubocop_merged_for_hound.yml - you want to regenerate this and commit

Usage

Every time you modify .rubocop_todo.yml or .hound/overrides.yml, you'll want to regenerate .rubocop_merged_for_hound.yml with:

$ bundle exec hound-tools

(And then you'll want to add all 3 to the repository before doing anything else).

Once you have your style working, you can simulate Hound with almost 100% accuracy with:

bundle exec rubocop

(If this shows no offenses, check the .rubocop_todo.yml file for disabled rules.)

Tips

  1. For quickly fixing most offenses, uncomment the 'auto-correct' ones in .rubocop_todo.yml simply run bundle exec rubocop -a

  2. The RuboCop README has tips on setting up Rake, Guard, etc.

Why is this so complex?

Well, simply because Hound doesn't support the RuboCop inherited_from keys. And that's because Hound is avoiding touching the filesystem - which makes sense since it downloads files to memory from GitHub.

Also, since Hound internally loads it's defaults and does a "mini-merge" of the configurations, it needs a different setup than Rubocop.

I won't mention the clever hacks in Hound to side-step directory traversing and other messy issues (e.g. handling excludes).

Alternatives

  1. Using only the default Hound settings (without being able to Hound-check them locally)

  2. Copying the default Hound settings (.hound/defaults.yml) to .rubocop.yml and tweak them (but you loose the flexibility and control of using multiple files and the coolness of .rubocop_todo.yml with 'inherited_from')

Contributing

  1. Fork it ( https://github.com/[my-github-username]/hound-tools/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request