Skip to content

Commit

Permalink
Merge pull request #198 from jmkoni/update-rubocop-to-0.9
Browse files Browse the repository at this point in the history
Update rubocop to 0.90
  • Loading branch information
searls committed Sep 4, 2020
2 parents c8fba57 + 067575f commit 2e6f39b
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 16 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
@@ -1,5 +1,20 @@
# Changelog

## 0.5.3

* Update Rubocop from
[0.89.1](https://github.com/rubocop-hq/rubocop/releases/tag/v0.89.1)
to
[0.90](https://github.com/rubocop-hq/rubocop/releases/tag/v0.90.0),
enabling:
* [`Style/KeywordParametersOrder`](https://github.com/rubocop-hq/rubocop/pull/8563)
* [`Lint/DuplicateRequire`](https://github.com/rubocop-hq/rubocop/pull/8474)
* [`Lint/TrailingCommaInAttributeDeclaration`](https://github.com/rubocop-hq/rubocop/pull/8549)
* Update [`Style/Alias` to prefer `alias_method`](https://github.com/testdouble/standard/pull/196)
* Update rubocop-performance from 1.7.1 to 1.8.0:
* Plan to enable [`Performance/Sum`](https://github.com/rubocop-hq/rubocop-performance/pull/137) in the future, but there is currently a bug in the implementation
* Add `ruby-2.3.yml` to add support for 2.3.

## 0.5.2

* Turned off `Lint/MissingSuper`, because it effectively bans a common idiom in
Expand Down Expand Up @@ -108,4 +123,3 @@
## 0.3.0

* Update Standard to track Rubocop 0.82.0 ([commit](https://github.com/testdouble/standard/commit/d663ea62d519c659087ad606bfed031c6303ff20))

14 changes: 7 additions & 7 deletions Gemfile.lock
Expand Up @@ -2,8 +2,8 @@ PATH
remote: .
specs:
standard (0.5.2)
rubocop (~> 0.89.1)
rubocop-performance (~> 1.7.1)
rubocop (~> 0.90)
rubocop-performance (~> 1.8.0)

GEM
remote: https://rubygems.org/
Expand All @@ -13,7 +13,7 @@ GEM
docile (1.3.2)
gimme (0.5.0)
method_source (1.0.0)
minitest (5.14.1)
minitest (5.14.2)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
Expand All @@ -24,7 +24,7 @@ GEM
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.2.4)
rubocop (0.89.1)
rubocop (0.90.0)
parallel (~> 1.10)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -35,10 +35,10 @@ GEM
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
rubocop-performance (1.7.1)
rubocop (>= 0.82.0)
rubocop-performance (1.8.0)
rubocop (>= 0.87.0)
ruby-progressbar (1.10.1)
simplecov (0.18.5)
simplecov (0.19.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov-html (0.12.2)
Expand Down
17 changes: 16 additions & 1 deletion config/base.yml
Expand Up @@ -350,10 +350,13 @@ Lint/DuplicateCaseCondition:
Lint/DuplicateElsifCondition:
Enabled: true

Lint/DuplicateHashKey:
Enabled: true

Lint/DuplicateMethods:
Enabled: true

Lint/DuplicateHashKey:
Lint/DuplicateRequire:
Enabled: true

Lint/DuplicateRescueException:
Expand Down Expand Up @@ -532,6 +535,9 @@ Lint/Syntax:
Lint/TopLevelReturnWithArgument:
Enabled: true

Lint/TrailingCommaInAttributeDeclaration:
Enabled: true

Lint/UnderscorePrefixedVariableName:
Enabled: true

Expand Down Expand Up @@ -593,6 +599,9 @@ Performance/BindCall:
Performance/Caller:
Enabled: true

Performance/CollectionLiteralInLoop:
Enabled: false

Performance/CompareWithBlock:
Enabled: true

Expand Down Expand Up @@ -667,6 +676,9 @@ Performance/StartWith:
Performance/StringReplacement:
Enabled: true

Performance/Sum:
Enabled: false

Performance/UnfreezeString:
Enabled: true

Expand Down Expand Up @@ -851,6 +863,9 @@ Style/InfiniteLoop:
Enabled: true
SafeAutoCorrect: true

Style/KeywordParametersOrder:
Enabled: true

Style/LambdaCall:
Enabled: true
EnforcedStyle: call
Expand Down
5 changes: 1 addition & 4 deletions config/ruby-2.2.yml
@@ -1,7 +1,4 @@
inherit_from: ./base.yml

AllCops:
TargetRubyVersion: 2.4 # The oldest supported
inherit_from: ./ruby-2.3.yml

Layout:
HeredocIndentation:
Expand Down
8 changes: 8 additions & 0 deletions config/ruby-2.3.yml
@@ -0,0 +1,8 @@
inherit_from: ./base.yml

AllCops:
TargetRubyVersion: 2.4 # The oldest supported

Performance:
Sum:
Enabled: false
2 changes: 2 additions & 0 deletions lib/standard/creates_config_store/assigns_rubocop_yaml.rb
Expand Up @@ -16,6 +16,8 @@ def rubocop_yaml_path(desired_version)
"ruby-1.9.yml"
elsif desired_version < Gem::Version.new("2.3")
"ruby-2.2.yml"
elsif desired_version < Gem::Version.new("2.4")
"ruby-2.3.yml"
else
"base.yml"
end
Expand Down
4 changes: 2 additions & 2 deletions standard.gemspec
Expand Up @@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "rubocop", "~> 0.89.1"
spec.add_dependency "rubocop-performance", "~> 1.7.1"
spec.add_dependency "rubocop", "~> 0.90"
spec.add_dependency "rubocop-performance", "~> 1.8.0"

spec.add_development_dependency "bundler"
spec.add_development_dependency "minitest", "~> 5.0"
Expand Down
13 changes: 13 additions & 0 deletions test/fixture/cli/autocorrectable-bad.rb
Expand Up @@ -13,8 +13,13 @@
}

class Something



alias do_more_stuff do_stuff

attr_reader :foo,

def do_stuff( a,b,c )
maths_and_stuff = 4 +
5 +
Expand Down Expand Up @@ -75,3 +80,11 @@ def setup_fog_credentials(config)
end

end

def bad_function(test: true, a:, b:)
if test
a
else
b
end
end
9 changes: 9 additions & 0 deletions test/fixture/cli/autocorrectable-good.rb
Expand Up @@ -15,6 +15,7 @@
class Something
alias_method :do_more_stuff, :do_stuff

attr_reader :foo
def do_stuff(a, b, c)
maths_and_stuff = 4 +
5 +
Expand Down Expand Up @@ -72,3 +73,11 @@ def setup_fog_credentials(config)
)
end
end

def bad_function(a:, b:, test: true)
if test
a
else
b
end
end
2 changes: 1 addition & 1 deletion test/standard/runners/rubocop_test.rb
Expand Up @@ -56,7 +56,7 @@ def test_print_corrected_output_on_stdin
C: 1: 8: [Corrected] Style/Semicolon: Do not use semicolons to terminate expressions.
C: 1: 9: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
1 file inspected, 6 offenses detected, 4 offenses corrected
1 file inspected, 6 offenses detected, 4 offenses corrected, 1 more offense can be corrected with `rubocop -A`
====================
def Foo
'hi'
Expand Down

0 comments on commit 2e6f39b

Please sign in to comment.