Ruby linting and testing for Pre-commit.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
.pre-commit-config.yaml
.pre-commit-hooks.yaml
.rubocop.yml
CONTRIBUTING.md
Gemfile
Gemfile.lock
LICENSE
README.md

README.md

pre-commit-ruby

This is a plugin for pre-commit that will run various ruby tools for linting and testing.

Usage

Hooks require that bundle be already available on your system.

To lint Ruby changes in your repo, use the rubocop hook. The root of your repo must have a Gemfile that includes the desired version of rubocop. It will be installed via Bundler prior to linting. Rubocop will only be run against changed files for each commit.

To lint Chef changes in your repo, use the foodcritic hook. The root of your repo must have a Gemfile that includes the desired version of foodcritic. It will be installed via Bundler prior to linting. Foodcritic will only be run against cookbooks with changes to Chef code; this does not include the libraries directory of a cookbook.

To unit test Ruby changes in your repo, use the rspec hook. Each path in your repo with a spec directory should have a Gemfile that includes your desired version of rspec (or a derivative library). It will be installed via Bundler prior to testing. Rspec will only be run against the closest directory in a changed file's path with a spec dir.

- repo: https://github.com/mattlqx/pre-commit-ruby
  rev: v1.1.0
  hooks:
  - id: rubocop
  - id: foodcritic
  - id: rspec