Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add RuboCop

  • Loading branch information...
commit 71d6443267110ce6100ca2260886211123c871c4 1 parent 2010c96
@sferik authored
View
80 .rubocop.yml
@@ -0,0 +1,80 @@
+AllCops:
+ Includes:
+ - 'Gemfile'
+ - 'Rakefile'
+ - 'rails_admin.gemspec'
+
+# Avoid long parameter lists
+ParameterLists:
+ Max: 3
+ CountKeywordArgs: true
+
+MethodLength:
+ CountComments: false
+ Max: 15
+
+# Avoid more than `Max` levels of nesting.
+BlockNesting:
+ Max: 3
+
+# Align with the style guide.
+CollectionMethods:
+ PreferredMethods:
+ map: 'collect'
+ reduce: 'inject'
+ find: 'detect'
+ find_all: 'select'
+
+# Do not force public/protected/private keyword to be indented at the same
+# level as the def keyword. My personal preference is to outdent these keywords
+# because I think when scanning code it makes it easier to identify the
+# sections of code and visually separate them. When the keyword is at the same
+# level I think it sort of blends in with the def keywords and makes it harder
+# to scan the code and see where the sections are.
+AccessModifierIndentation:
+ Enabled: false
+
+# Limit line length
+LineLength:
+ Enabled: false
+
+# Disable documentation checking until a class needs to be documented once
+Documentation:
+ Enabled: false
+
+# 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
View
1  .travis.yml
@@ -39,3 +39,4 @@ before_script:
- cd ../../
services:
- mongodb
+script: bundle exec rake default
View
2  CONTRIBUTING.md
@@ -48,7 +48,7 @@ pull request with failing specs.
3. Add specs for your unimplemented feature or bug fix.
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
5. Implement your feature or bug fix.
-6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
+6. Run `bundle exec rake default`. If your specs fail, return to step 5.
7. Run `open coverage/index.html`. If your changes are not completely covered
by your tests, return to step 3.
8. Add, commit, and push your changes.
View
9 Gemfile
@@ -36,7 +36,11 @@ end
group :development, :test do
gem 'pry', '>= 0.9'
- gem 'pry-debugger', '>= 0.2', :platforms => [:mri_19, :mri_20]
+ gem 'pry-rescue', '>= 1.2'
+ platforms :mri_19, :mri_20 do
+ gem 'pry-debugger', '>= 0.2'
+ gem 'pry-stack_explorer', '>= 0.4.9.1'
+ end
end
group :test do
@@ -47,14 +51,15 @@ group :test do
gem 'database_cleaner', '>= 1.2'
gem 'devise', '>= 3.2'
gem 'dragonfly', '~> 0.9.0'
- gem 'rack-cache', :require => 'rack/cache'
gem 'factory_girl', '>= 4.2'
gem 'generator_spec', '>= 0.8'
gem 'launchy', '>= 2.2'
gem 'mini_magick', '>= 3.4'
gem 'paperclip', '>= 3.4'
gem 'poltergeist', :github => 'jonleighton/poltergeist'
+ gem 'rack-cache', :require => 'rack/cache'
gem 'rspec-rails', '>= 2.14'
+ gem 'rubocop', '>= 0.15'
gem 'simplecov', :require => false
gem 'timecop', '>= 0.5'
end
View
13 Rakefile
@@ -10,4 +10,15 @@ require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :test => :spec
-task :default => :spec
+
+begin
+ require 'rubocop/rake_task'
+ Rubocop::RakeTask.new
+rescue LoadError
+ desc 'Run RuboCop'
+ task :rubocop do
+ $stderr.puts 'Rubocop is disabled'
+ end
+end
+
+task :default => [:spec, :rubocop]
Please sign in to comment.
Something went wrong with that request. Please try again.