Skip to content

Instantly share code, notes, and snippets.

@mipearson
Last active August 29, 2015 14:09
Show Gist options
  • Save mipearson/417046bfeacc8d2fc5ad to your computer and use it in GitHub Desktop.
Save mipearson/417046bfeacc8d2fc5ad to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
changed = `git diff --numstat origin/master | awk '{ print $3 }' | grep -E '(\\.rb|\\.rake)$' | grep -v db/schema`
changed = changed.split("\n").select { |c| File.exist?(c) }
if changed.length > 0
system "bundle exec rubocop #{ARGV.join(' ')} #{changed.join(' ')}"
else
puts "No changes."
end
AllCops:
Exclude:
- 'features/**'
- 'db/**'
RunRailsCops: true
AlignHash:
EnforcedLastArgumentHashStyle: always_ignore
AlignParameters:
Enabled: false
LineLength:
Max: 180
ClassLength:
Enabled: true
Severity: refactor
Max: 300
MethodLength:
Enabled: true
Max: 30
Severity: refactor
CyclomaticComplexity:
Max: 10
Severity: refactor
EndAlignment:
Enabled: false
StringLiterals:
Enabled: false
Documentation:
Enabled: false
PercentLiteralDelimiters:
PreferredDelimiters:
'%w': '{}'
MethodDefParentheses:
Enabled: false
PredicateName:
NamePrefixBlacklist:
- is_
- have_
IndentHash:
EnforcedStyle: consistent
# breaks using if blocks with assignments
IndentationWidth:
Enabled: false
CaseIndentation:
IndentWhenRelativeTo: end
FormatString:
Enabled: false
ActionFilter:
Enabled: false
# different methods calls that do exactly the same thing are a smell, regardless of semantics
SignalException:
EnforcedStyle: only_raise
# Files in lib/migrations are allowed to puts things
Rails/Output:
Exclude:
- lib/migrations/*
- script/*
Rails/DefaultScope:
Include:
- app/models/*.rb
- app/models/**/*.rb
Rails/HasAndBelongsToMany:
Enabled: false
Rails/ScopeArgs:
Include:
- app/models/*.rb
- app/models/**/*.rb
Rails/Validation:
Include:
- app/models/*.rb
- app/models/**/*.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment