From 2514709594ceea351bbcbbdc67de09f22adce8f7 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 20 Apr 2015 13:18:37 +0100 Subject: [PATCH] Update rubocop to version 0.30.0 --- .rubocop.yml | 116 +++++++--------------- .travis.yml | 6 +- Gemfile.lock | 2 +- app/controllers/info_window_controller.rb | 10 +- app/helpers/application_helper.rb | 2 +- 5 files changed, 45 insertions(+), 91 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0f0f5f8..ffd0357 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,107 +1,59 @@ AllCops: - Include: - - 'Gemfile' - - 'Rakefile' + RunRailsCops: true Exclude: - 'bin/*' - 'db/schema.rb' - 'db/seeds.rb' - 'vendor/bundle/**/*' -# Avoid long parameter lists -ParameterLists: +Metrics/AbcSize: + Exclude: + - 'app/controllers/passwords_controller.rb' + - 'app/controllers/sessions_controller.rb' + - 'app/controllers/users_controller.rb' + +Metrics/BlockNesting: + Max: 2 + +Metrics/LineLength: + AllowURI: true + Enabled: false + +Metrics/MethodLength: + CountComments: false + Max: 10 + Exclude: + - 'db/migrate/*.rb' + +Metrics/ParameterLists: Max: 4 CountKeywordArgs: true -ClassLength: - Max: 100 +Style/AccessModifierIndentation: + EnforcedStyle: outdent -LineLength: - Enabled: false - -MethodLength: - CountComments: false - Max: 15 - -# Avoid more than `Max` levels of nesting. -BlockNesting: - Max: 2 - -AbcSize: - Enabled: false - -# Align with the style guide. -CollectionMethods: +Style/CollectionMethods: PreferredMethods: map: 'collect' reduce: 'inject' find: 'detect' find_all: 'select' -# Disable documentation checking until a class needs to be documented once -Documentation: +Style/Documentation: Enabled: false -# Enforce Ruby 1.9-compatible hash syntax -HashSyntax: - EnforcedStyle: ruby19 +Style/DotPosition: + EnforcedStyle: trailing -# No spaces inside hash literals -SpaceInsideHashLiteralBraces: +Style/DoubleNegation: + Enabled: false + +Style/SpaceInsideHashLiteralBraces: EnforcedStyle: no_space -# Allow dots at the end of lines -DotPosition: - Enabled: false +Style/TrailingComma: + EnforcedStyleForMultiline: 'comma' -# 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': () - -WordArray: +Style/WordArray: Exclude: - 'app/helpers/application_helper.rb' - -NumericLiterals: - Exclude: - - 'db/seeds.rb' diff --git a/.travis.yml b/.travis.yml index ea9c702..f353734 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,10 @@ bundler_args: "--without assets:development:production" cache: bundler language: ruby rvm: -- 2.2.2 + - 2.2.2 script: -- bundle exec rake -- bundle exec rubocop --rails --fail-level=refactor + - bundle exec rake + - bundle exec rubocop sudo: false deploy: api_key: diff --git a/Gemfile.lock b/Gemfile.lock index d437337..d44ad06 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -177,7 +177,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) - rubocop (0.29.1) + rubocop (0.30.0) astrolabe (~> 1.3) parser (>= 2.2.0.1, < 3.0) powerpack (~> 0.1) diff --git a/app/controllers/info_window_controller.rb b/app/controllers/info_window_controller.rb index 15be9f2..8e1508f 100644 --- a/app/controllers/info_window_controller.rb +++ b/app/controllers/info_window_controller.rb @@ -1,10 +1,12 @@ class InfoWindowController < ApplicationController def index @thing = Thing.find_by_id(params[:thing_id]) - view = if @thing.adopted? - user_signed_in? && current_user == @thing.user ? 'users/thank_you' : 'users/profile' - else - user_signed_in? ? 'things/adopt' : 'users/sign_in' + view = begin + if @thing.adopted? + user_signed_in? && current_user == @thing.user ? 'users/thank_you' : 'users/profile' + else + user_signed_in? ? 'things/adopt' : 'users/sign_in' + end end render view end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8410d84..f648307 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -53,7 +53,7 @@ module ApplicationHelper ['Washington', 'WA'], ['West Virginia', 'WV'], ['Wisconsin', 'WI'], - ['Wyoming', 'WY'] + ['Wyoming', 'WY'], ] end end