From 484633c63d49e1ffb3859e9edc48765fe7c608f7 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Fri, 28 Mar 2014 16:00:40 +0100 Subject: [PATCH] Add RuboCop --- .rubocop.yml | 46 +++++++++++++++++++++++++++++++++++++++------- Gemfile | 1 + Gemfile.lock | 14 ++++++++++++++ 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0fbf5e0..45a7fb2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,16 +2,23 @@ AllCops: Includes: - 'Gemfile' - 'Rakefile' - - 'twitter.gemspec' + Excludes: + - 'db/schema.rb' # Avoid long parameter lists ParameterLists: Max: 4 CountKeywordArgs: true +ClassLength: + Max: 100 + +LineLength: + Enabled: false + MethodLength: CountComments: false - Max: 14 + Max: 15 # Avoid more than `Max` levels of nesting. BlockNesting: @@ -25,15 +32,11 @@ CollectionMethods: find: 'detect' find_all: 'select' -# 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 +# Enforce Ruby 1.9-compatible hash syntax HashSyntax: EnforcedStyle: ruby19 @@ -67,3 +70,32 @@ CaseIndentation: Lambda: Enabled: false + +RaiseArgs: + EnforcedStyle: compact + +TrailingComma: + Enabled: false + +DoubleNegation: + Enabled: false + +PercentLiteralDelimiters: + PreferredDelimiters: + '%': () + '%i': () + '%q': () + '%Q': () + '%r': '{}' + '%s': () + '%w': '[]' + '%W': '[]' + '%x': () + +WordArray: + Exclude: + - 'app/helpers/application_helper.rb' + +NumericLiterals: + Exclude: + - 'db/seeds.rb' diff --git a/Gemfile b/Gemfile index 6b13f2d..16e0e2f 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,7 @@ end group :test do gem 'coveralls', require: false + gem 'rubocop' gem 'simplecov', require: false gem 'sqlite3' gem 'webmock' diff --git a/Gemfile.lock b/Gemfile.lock index 89d411c..a87eced 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,6 +27,7 @@ GEM tzinfo (~> 0.3.37) addressable (2.3.6) arel (4.0.2) + ast (1.1.0) atomic (1.1.16) bcrypt (3.1.7) builder (3.1.4) @@ -86,8 +87,12 @@ GEM nokogiri (1.6.1) mini_portile (~> 0.5.0) orm_adapter (0.5.0) + parser (2.1.7) + ast (~> 1.1) + slop (~> 3.4, >= 3.4.5) pg (0.17.1) polyglot (0.3.4) + powerpack (0.0.9) pry (0.9.12.6) coderay (~> 1.0) method_source (~> 0.8) @@ -132,10 +137,18 @@ GEM activesupport (= 4.0.4) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) + rainbow (2.0.0) rake (10.2.2) remotipart (1.2.1) rest-client (1.6.7) mime-types (>= 1.16) + rubocop (0.19.1) + json (>= 1.7.7, < 2) + parser (~> 2.1.7) + powerpack (~> 0.0.6) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.4) + ruby-progressbar (1.4.2) safe_yaml (1.0.1) sass (3.3.4) sass-rails (4.0.1) @@ -198,6 +211,7 @@ DEPENDENCIES rails (~> 4.0.4) rails_12factor rails_admin + rubocop sass-rails simplecov sqlite3