Skip to content

Instantly share code, notes, and snippets.

@davidlibrera
davidlibrera / .rubocop.yaml
Last active April 4, 2018 13:23
Cantiere Creativo Rubocop Overrides
require: rubocop-rspec
AllCops:
Exclude:
- "bin/**/*"
- ".bundle/**/*"
- "db/schema.rb"
- "node_modules/**/*"
Layout/AlignParameters:
@davidlibrera
davidlibrera / rubocop_pre_commit_hook
Last active March 29, 2018 18:02
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
#!/usr/bin/env ruby
require 'rubocop'
changed_files = `git diff --name-only --cached`.split(/\n/).
select { |file_name|
file_name.end_with?(".rb") ||
file_name.match?(/^Gemfile/)
}.join(' ')