diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f4cd662..282a3f1d 100644 --- a/CHANGELOG.md +++ b/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 @@ -108,4 +123,3 @@ ## 0.3.0 * Update Standard to track Rubocop 0.82.0 ([commit](https://github.com/testdouble/standard/commit/d663ea62d519c659087ad606bfed031c6303ff20)) - diff --git a/Gemfile.lock b/Gemfile.lock index 7a5ccddf..c29fdc40 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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/ @@ -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) @@ -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) @@ -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) diff --git a/config/base.yml b/config/base.yml index a46efac4..42d1454c 100644 --- a/config/base.yml +++ b/config/base.yml @@ -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: @@ -532,6 +535,9 @@ Lint/Syntax: Lint/TopLevelReturnWithArgument: Enabled: true +Lint/TrailingCommaInAttributeDeclaration: + Enabled: true + Lint/UnderscorePrefixedVariableName: Enabled: true @@ -593,6 +599,9 @@ Performance/BindCall: Performance/Caller: Enabled: true +Performance/CollectionLiteralInLoop: + Enabled: false + Performance/CompareWithBlock: Enabled: true @@ -667,6 +676,9 @@ Performance/StartWith: Performance/StringReplacement: Enabled: true +Performance/Sum: + Enabled: false + Performance/UnfreezeString: Enabled: true @@ -851,6 +863,9 @@ Style/InfiniteLoop: Enabled: true SafeAutoCorrect: true +Style/KeywordParametersOrder: + Enabled: true + Style/LambdaCall: Enabled: true EnforcedStyle: call diff --git a/config/ruby-2.2.yml b/config/ruby-2.2.yml index c0b84a3c..7ae6a69d 100644 --- a/config/ruby-2.2.yml +++ b/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: diff --git a/config/ruby-2.3.yml b/config/ruby-2.3.yml new file mode 100644 index 00000000..df91d523 --- /dev/null +++ b/config/ruby-2.3.yml @@ -0,0 +1,8 @@ +inherit_from: ./base.yml + +AllCops: + TargetRubyVersion: 2.4 # The oldest supported + +Performance: + Sum: + Enabled: false diff --git a/lib/standard/creates_config_store/assigns_rubocop_yaml.rb b/lib/standard/creates_config_store/assigns_rubocop_yaml.rb index a90f8f22..9e5dcf9b 100644 --- a/lib/standard/creates_config_store/assigns_rubocop_yaml.rb +++ b/lib/standard/creates_config_store/assigns_rubocop_yaml.rb @@ -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 diff --git a/standard.gemspec b/standard.gemspec index 1e7758a2..189ec25a 100644 --- a/standard.gemspec +++ b/standard.gemspec @@ -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" diff --git a/test/fixture/cli/autocorrectable-bad.rb b/test/fixture/cli/autocorrectable-bad.rb index 358c85c7..296360dc 100644 --- a/test/fixture/cli/autocorrectable-bad.rb +++ b/test/fixture/cli/autocorrectable-bad.rb @@ -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 + @@ -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 diff --git a/test/fixture/cli/autocorrectable-good.rb b/test/fixture/cli/autocorrectable-good.rb index 72b8bdec..989b6ce7 100644 --- a/test/fixture/cli/autocorrectable-good.rb +++ b/test/fixture/cli/autocorrectable-good.rb @@ -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 + @@ -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 diff --git a/test/standard/runners/rubocop_test.rb b/test/standard/runners/rubocop_test.rb index 24f7c9ea..f25d2709 100644 --- a/test/standard/runners/rubocop_test.rb +++ b/test/standard/runners/rubocop_test.rb @@ -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'