From 0a770918b2aa3cb5adbbcbb10efbf514dc4c3865 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 4 Jun 2017 02:35:21 +0200 Subject: [PATCH] Bump rubocop --- .rubocop.yml | 16 ++++++++-------- Gemfile | 2 +- Gemfile.lock | 6 ++++-- .../validators/rules/boolean.rb | 4 ++-- spec/lib/diaspora_federation/entity_spec.rb | 4 ++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7341042..47685c1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -28,7 +28,7 @@ Metrics/AbcSize: # No space makes the method definition shorter and differentiates # from a regular assignment. -Style/SpaceAroundEqualsInParameterDefault: +Layout/SpaceAroundEqualsInParameterDefault: EnforcedStyle: no_space # Single quotes being faster is hardly measurable and only affects parse time. @@ -43,7 +43,7 @@ Style/SymbolArray: Enabled: true # Most readable form. -Style/AlignHash: +Layout/AlignHash: EnforcedHashRocketStyle: table EnforcedColonStyle: table @@ -80,7 +80,7 @@ Style/RaiseArgs: # Indenting the chained dots beneath each other is not supported by this cop, # see https://github.com/bbatsov/rubocop/issues/1633 -Style/MultilineOperationIndentation: +Layout/MultilineOperationIndentation: Enabled: false # Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain. @@ -95,7 +95,7 @@ Style/SignalException: Lint/HandleExceptions: Enabled: false -Style/SpaceInsideBlockBraces: +Layout/SpaceInsideBlockBraces: # The space here provides no real gain in readability while consuming # horizontal space that could be used for a better parameter name. # Also {| differentiates better from a hash than { | does. @@ -103,7 +103,7 @@ Style/SpaceInsideBlockBraces: # No trailing space differentiates better from the block: # foo} means hash, foo } means block. -Style/SpaceInsideHashLiteralBraces: +Layout/SpaceInsideHashLiteralBraces: EnforcedStyle: no_space # { ... } for multi-line blocks is okay, follow Weirichs rule instead: @@ -145,7 +145,7 @@ Lint/Debugger: # Reset some HoundCI changes back to Rubocop defaults -Style/DotPosition: +Layout/DotPosition: EnforcedStyle: leading @@ -182,7 +182,7 @@ Rails/Present: Style/SingleLineMethods: Exclude: - "test/dummy/app/models/*" -Style/EmptyLineBetweenDefs: +Layout/EmptyLineBetweenDefs: Exclude: - "test/dummy/app/models/*" @@ -206,7 +206,7 @@ Style/FrozenStringLiteralComment: Enabled: false Style/SafeNavigation: Enabled: false -Style/IndentHeredoc: +Layout/IndentHeredoc: Enabled: false # only with ruby >= 2.4 diff --git a/Gemfile b/Gemfile index ed14779..6c8c9df 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ group :development do # code style gem "pronto", "0.9.3", require: false gem "pronto-rubocop", "0.9.0", require: false - gem "rubocop", "0.48.1", require: false + gem "rubocop", "0.49.1", require: false # automatic test runs gem "guard-rspec", require: false diff --git a/Gemfile.lock b/Gemfile.lock index f65381f..b96d908 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -115,6 +115,7 @@ GEM rspec (>= 2.99, >= 2.14.2, < 4) octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) + parallel (1.11.2) parser (2.4.0.0) ast (~> 2.2) powerpack (0.1.1) @@ -180,7 +181,8 @@ GEM rspec-mocks (~> 3.6.0) rspec-support (~> 3.6.0) rspec-support (3.6.0) - rubocop (0.48.1) + rubocop (0.49.1) + parallel (~> 1.10) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) @@ -250,7 +252,7 @@ DEPENDENCIES rspec-collection_matchers (~> 1.1.2) rspec-json_expectations (~> 2.1) rspec-rails (~> 3.6.0) - rubocop (= 0.48.1) + rubocop (= 0.49.1) simplecov (= 0.14.1) simplecov-rcov (= 0.2.3) spring diff --git a/lib/diaspora_federation/validators/rules/boolean.rb b/lib/diaspora_federation/validators/rules/boolean.rb index c0d268b..6c0418d 100644 --- a/lib/diaspora_federation/validators/rules/boolean.rb +++ b/lib/diaspora_federation/validators/rules/boolean.rb @@ -20,8 +20,8 @@ module Validation if value.is_a?(String) true if value =~ /\A(true|false|t|f|yes|no|y|n|1|0)\z/i elsif value.is_a?(Integer) - true if value == 1 || value == 0 - elsif [true, false].include? value + true if [1, 0].include?(value) + elsif [true, false].include?(value) true else false diff --git a/spec/lib/diaspora_federation/entity_spec.rb b/spec/lib/diaspora_federation/entity_spec.rb index ec0df37..2a382d6 100644 --- a/spec/lib/diaspora_federation/entity_spec.rb +++ b/spec/lib/diaspora_federation/entity_spec.rb @@ -145,8 +145,8 @@ XML it "passes input parameter directly to .parse method of the parser" do root = Nokogiri::XML("").root - expect_any_instance_of(DiasporaFederation::Parsers::XmlParser).to receive(:parse).with(root) - .and_return([{test1: "2", test2: "1"}]) + expect_any_instance_of(DiasporaFederation::Parsers::XmlParser) + .to receive(:parse).with(root).and_return([{test1: "2", test2: "1"}]) Entities::TestDefaultEntity.from_xml(root) end end