Skip to content

Commit

Permalink
Add RuboCop
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jun 25, 2014
1 parent 0911146 commit ca7279e
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 1 deletion.
96 changes: 96 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
AllCops:
Include:
- 'Gemfile'
- 'Rakefile'
- 'delayed_job.gemspec'

# Avoid long parameter lists
ParameterLists:
Max: 4
CountKeywordArgs: true

ClassLength:
Max: 100

LineLength:
Enabled: false

MethodLength:
CountComments: false
Max: 53

# Avoid more than `Max` levels of nesting.
BlockNesting:
Max: 2

# Align with the style guide.
CollectionMethods:
PreferredMethods:
map: 'collect'
map!: 'collect!'
reduce: 'inject'
find: 'detect'
find_all: 'select'

# Disable documentation checking until a class needs to be documented once
Documentation:
Enabled: false

# Enforce Ruby 1.8-compatible hash syntax
HashSyntax:
EnforcedStyle: hash_rockets

# No spaces inside hash literals
SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

# Allow dots at the end of lines
DotPosition:
Enabled: false

# Don't require magic comment at the top of every file
Encoding:
Enabled: false

# Enforce outdenting of access modifiers (i.e. public, private, protected)
AccessModifierIndentation:
EnforcedStyle: outdent

EmptyLinesAroundAccessModifier:
Enabled: true

# Align ends correctly
EndAlignment:
AlignWith: variable

# Indentation of when/else
CaseIndentation:
IndentWhenRelativeTo: end
IndentOneStep: false

Lambda:
Enabled: false

RaiseArgs:
EnforcedStyle: compact

TrailingComma:
Enabled: false

DoubleNegation:
Enabled: false

PercentLiteralDelimiters:
PreferredDelimiters:
'%': ()
'%i': ()
'%q': ()
'%Q': ()
'%r': '{}'
'%s': ()
'%w': '[]'
'%W': '[]'
'%x': ()

NonNilCheck:
Enabled: false
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ group :test do
gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 4.2'])
gem 'coveralls', :require => false
gem 'rspec', '>= 3'
gem 'rubocop', '>= 0.23'
gem 'simplecov', :require => false
end

Expand Down
7 changes: 6 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ RSpec::Core::RakeTask.new do |r|
r.verbose = false
end

task :default => :spec
task :test => :spec

require 'rubocop/rake_task'
RuboCop::RakeTask.new

task :default => [:spec, :rubocop]

0 comments on commit ca7279e

Please sign in to comment.