Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add RuboCop

  • Loading branch information...
commit 798e56f5bd87f0fda29ad1e6d122fe0fcb378c85 1 parent 5998b76
@sferik sferik authored
Showing with 91 additions and 1 deletion.
  1. +78 −0 .rubocop.yml
  2. +2 −0  Gemfile
  3. +11 −1 Rakefile
View
78 .rubocop.yml
@@ -0,0 +1,78 @@
+AllCops:
+ Includes:
+ - 'Gemfile'
+ - 'Rakefile'
+ - 'tweetstream.gemspec'
+
+# Avoid long parameter lists
+ParameterLists:
+ Max: 3
+ CountKeywordArgs: true
+
+MethodLength:
+ CountComments: false
+ Max: 35
+
+# Avoid more than `Max` levels of nesting.
+BlockNesting:
+ Max: 2
+
+# 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
+
+# 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
View
2  Gemfile
@@ -16,12 +16,14 @@ group :test do
gem 'coveralls', :require => false
gem 'json', :platforms => :ruby_18
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
+ gem 'rubocop', '>= 0.16', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'rspec', '>= 2.14'
gem 'simplecov', :require => false
gem 'webmock'
end
platforms :rbx do
+ gem 'racc'
gem 'rubinius-coverage', '~> 2.0'
gem 'rubysl', '~> 2.0'
end
View
12 Rakefile
@@ -5,7 +5,17 @@ require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :test => :spec
-task :default => :spec
require 'yard'
YARD::Rake::YardocTask.new
+
+begin
+ require 'rubocop/rake_task'
+ Rubocop::RakeTask.new
+rescue LoadError
+ 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.