From f1a96f5839015192575301742fcc5be68540d537 Mon Sep 17 00:00:00 2001 From: Nico Wenterodt Date: Mon, 11 Nov 2024 20:05:36 +0100 Subject: [PATCH 1/4] update Rubocop to v1.68 --- CHANGELOG.md | 4 ++++ Gemfile.lock | 4 ++-- standard.gemspec | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5733b0b2..b605023d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## 1.41.2 + +* Updates rubocop to [1.68](https://github.com/rubocop/rubocop/releases/tag/v1.68) + ## 1.41.1 * Adds a stub method to the Ruby LSP add-on to avoid a potential runtime exception diff --git a/Gemfile.lock b/Gemfile.lock index 30fb9811..087a10ac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,7 +4,7 @@ PATH standard (1.41.1) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.66.0) + rubocop (~> 1.68.0) standard-custom (~> 1.0.0) standard-performance (~> 1.5) @@ -34,7 +34,7 @@ GEM rbs (3.5.2) logger regexp_parser (2.8.2) - rubocop (1.66.1) + rubocop (1.68.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) diff --git a/standard.gemspec b/standard.gemspec index f1fa51d9..c7fc5388 100644 --- a/standard.gemspec +++ b/standard.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.metadata["rubygems_mfa_required"] = "true" - spec.add_dependency "rubocop", "~> 1.66.0" + spec.add_dependency "rubocop", "~> 1.68.0" spec.add_dependency "lint_roller", "~> 1.0" spec.add_dependency "standard-custom", "~> 1.0.0" From 98d4bbe36b5b7d56c76f38b03e1c48d25d086221 Mon Sep 17 00:00:00 2001 From: Nico Wenterodt Date: Mon, 11 Nov 2024 20:41:23 +0100 Subject: [PATCH 2/4] add new cops --- config/base.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/config/base.yml b/config/base.yml index 3a66e759..5c58b249 100644 --- a/config/base.yml +++ b/config/base.yml @@ -512,6 +512,9 @@ Lint/DuplicateRequire: Lint/DuplicateRescueException: Enabled: true +Lint/DuplicateSetElement: + Enabled: false + Lint/EachWithObjectArgument: Enabled: true @@ -798,6 +801,9 @@ Lint/TripleQuotes: Lint/UnderscorePrefixedVariableName: Enabled: true +Lint/UnescapedBracketInRegexp: + Enabled: false + Lint/UnexpectedBlockArity: Enabled: false @@ -980,6 +986,9 @@ Style/Alias: Enabled: true EnforcedStyle: prefer_alias_method +Style/AmbiguousEndlessMethodDefinition: + Enabled: false + Style/AndOr: Enabled: true @@ -1017,6 +1026,9 @@ Style/BeginBlock: Style/BisectedAttrAccessor: Enabled: false +Style/BitwisePredicate: + Enabled: false + Style/BlockComments: Enabled: true @@ -1063,6 +1075,9 @@ Style/ColonMethodCall: Style/ColonMethodDefinition: Enabled: true +Style/CombinableDefined: + Enabled: false + Style/CombinableLoops: Enabled: false @@ -1290,6 +1305,9 @@ Style/InvertibleUnlessCondition: Style/IpAddresses: Enabled: false +Style/KeywordArgumentsMerging: + Enabled: false + Style/KeywordParametersOrder: Enabled: true @@ -1655,6 +1673,9 @@ Style/SafeNavigation: - try - try! +Style/SafeNavigationChainLength: + Emabled: false + Style/Sample: Enabled: true From 924f830bc6a8afd1fb3ce929922f7e2afe3e0b53 Mon Sep 17 00:00:00 2001 From: Nico Wenterodt Date: Mon, 11 Nov 2024 20:42:08 +0100 Subject: [PATCH 3/4] deprecation warning fix: inerherit from RuboCop::Cop::Base instead of RuboCop::Cop::Cop --- test/fixture/extend_config/bananas.rb | 2 +- test/fixture/extend_config/betterment.rb | 2 +- test/fixture/plugins/project/lib/banana/banana_bomb.rb | 2 +- test/fixture/plugins/project/lib/banana/bananas.rb | 2 +- .../plugin/merges_plugins_into_rubocop_config_test.rb | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/fixture/extend_config/bananas.rb b/test/fixture/extend_config/bananas.rb index d0066bc6..6fca5911 100644 --- a/test/fixture/extend_config/bananas.rb +++ b/test/fixture/extend_config/bananas.rb @@ -1,7 +1,7 @@ module RuboCop module Cop module Bananas - class BananasOnly < Cop + class BananasOnly < Base def on_lvasgn(node) name, = *node diff --git a/test/fixture/extend_config/betterment.rb b/test/fixture/extend_config/betterment.rb index 0ef05db4..1524b853 100644 --- a/test/fixture/extend_config/betterment.rb +++ b/test/fixture/extend_config/betterment.rb @@ -1,7 +1,7 @@ module RuboCop module Cop module Betterment - class UnscopedFind < Cop + class UnscopedFind < Base end end end diff --git a/test/fixture/plugins/project/lib/banana/banana_bomb.rb b/test/fixture/plugins/project/lib/banana/banana_bomb.rb index 7723710d..a58f998e 100644 --- a/test/fixture/plugins/project/lib/banana/banana_bomb.rb +++ b/test/fixture/plugins/project/lib/banana/banana_bomb.rb @@ -2,7 +2,7 @@ module RuboCop module Cop module Bananas - class BananaBomb < Cop + class BananaBomb < Base def on_class(node) add_offense(node, message: "🍌💣 - Better ignore me!") end diff --git a/test/fixture/plugins/project/lib/banana/bananas.rb b/test/fixture/plugins/project/lib/banana/bananas.rb index ac0ced92..b5053edf 100644 --- a/test/fixture/plugins/project/lib/banana/bananas.rb +++ b/test/fixture/plugins/project/lib/banana/bananas.rb @@ -1,7 +1,7 @@ module RuboCop module Cop module Bananas - class BananasOnly < Cop + class BananasOnly < Base def on_lvasgn(node) # cracks me up that we have to disable this cop inside itself name, = *node # standard:disable Bananas/BananasOnly diff --git a/test/standard/plugin/merges_plugins_into_rubocop_config_test.rb b/test/standard/plugin/merges_plugins_into_rubocop_config_test.rb index 064823d8..adf318ed 100644 --- a/test/standard/plugin/merges_plugins_into_rubocop_config_test.rb +++ b/test/standard/plugin/merges_plugins_into_rubocop_config_test.rb @@ -53,16 +53,16 @@ def rules(context) module RuboCop::Cop module Fake - class Things < RuboCop::Cop::Cop + class Things < RuboCop::Cop::Base end - class Stuff < RuboCop::Cop::Cop + class Stuff < RuboCop::Cop::Base end - class Junk < RuboCop::Cop::Cop + class Junk < RuboCop::Cop::Base end - class Crap < RuboCop::Cop::Cop + class Crap < RuboCop::Cop::Base end end end From f49e6adc58bc57c5bccad2b93a823c27da753bc6 Mon Sep 17 00:00:00 2001 From: Nico Wenterodt Date: Mon, 11 Nov 2024 20:42:20 +0100 Subject: [PATCH 4/4] update changelog enctry --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b605023d..cd9d029a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ## Unreleased -## 1.41.2 - -* Updates rubocop to [1.68](https://github.com/rubocop/rubocop/releases/tag/v1.68) +* Updates rubocop to [1.68.0]https://github.com/rubocop/rubocop/tree/v1.68.0) +* Inherit from `RuboCop::Cop::Base` fixing deprecation warnings. +* Add new cops ## 1.41.1