From 703e1a87bcca81f59fd7d359d9d56882815397ef Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Sun, 9 Jun 2024 19:35:49 +0200 Subject: [PATCH 1/4] Update config/default.yml with recent releases --- config/default.yml | 18 +++++++++--------- docs/modules/ROOT/pages/cops_rspec.adoc | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/config/default.yml b/config/default.yml index 5de0dedc3..6d2c64027 100644 --- a/config/default.yml +++ b/config/default.yml @@ -149,7 +149,7 @@ RSpec/BeEmpty: Enabled: true AutoCorrect: contextual VersionAdded: '2.20' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEmpty RSpec/BeEq: @@ -316,7 +316,7 @@ RSpec/EmptyExampleGroup: AutoCorrect: contextual SafeAutoCorrect: false VersionAdded: '1.7' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup RSpec/EmptyHook: @@ -324,7 +324,7 @@ RSpec/EmptyHook: Enabled: true AutoCorrect: contextual VersionAdded: '1.39' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook RSpec/EmptyLineAfterExample: @@ -370,7 +370,7 @@ RSpec/EmptyMetadata: Enabled: true AutoCorrect: contextual VersionAdded: '2.24' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyMetadata RSpec/EmptyOutput: @@ -471,7 +471,7 @@ RSpec/Focus: Enabled: true AutoCorrect: contextual VersionAdded: '1.5' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus RSpec/HookArgument: @@ -491,7 +491,7 @@ RSpec/HooksBeforeExamples: Enabled: true AutoCorrect: contextual VersionAdded: '1.29' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples RSpec/IdenticalEqualityAssertion: @@ -599,7 +599,7 @@ RSpec/LetBeforeExamples: Enabled: true AutoCorrect: contextual VersionAdded: '1.16' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples RSpec/LetSetup: @@ -857,7 +857,7 @@ RSpec/ScatteredLet: Enabled: true AutoCorrect: contextual VersionAdded: '1.14' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet RSpec/ScatteredSetup: @@ -865,7 +865,7 @@ RSpec/ScatteredSetup: Enabled: true AutoCorrect: contextual VersionAdded: '1.10' - VersionChanged: "<>" + VersionChanged: '2.31' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup RSpec/SharedContext: diff --git a/docs/modules/ROOT/pages/cops_rspec.adoc b/docs/modules/ROOT/pages/cops_rspec.adoc index 528cea36e..83925346c 100644 --- a/docs/modules/ROOT/pages/cops_rspec.adoc +++ b/docs/modules/ROOT/pages/cops_rspec.adoc @@ -201,7 +201,7 @@ expect(foo).to be(true) | Yes | Command-line only | 2.20 -| <> +| 2.31 |=== Prefer using `be_empty` when checking for an empty array. @@ -1155,7 +1155,7 @@ describe 'Something', :a | Yes | Command-line only (Unsafe) | 1.7 -| <> +| 2.31 |=== Checks if an example group does not include any tests. @@ -1209,7 +1209,7 @@ end | Yes | Command-line only | 1.39 -| <> +| 2.31 |=== Checks for empty before and after hooks. @@ -1512,7 +1512,7 @@ let(:foo) { bar } | Yes | Command-line only | 2.24 -| <> +| 2.31 |=== Avoid empty metadata hash. @@ -2129,7 +2129,7 @@ expect { my_app.print_report }.to output('Hello World').to_stdout | Yes | Command-line only | 1.5 -| <> +| 2.31 |=== Checks if examples are focused. @@ -2291,7 +2291,7 @@ end | Yes | Command-line only | 1.29 -| <> +| 2.31 |=== Checks for before/around/after hooks that come after an example. @@ -3046,7 +3046,7 @@ end | Yes | Command-line only | 1.16 -| <> +| 2.31 |=== Checks for `let` definitions that come after an example. @@ -5038,7 +5038,7 @@ allow(Foo).to receive(:bar).and_return(bar.baz) | Yes | Command-line only | 1.14 -| <> +| 2.31 |=== Checks for let scattered across the example group. @@ -5081,7 +5081,7 @@ end | Yes | Command-line only | 1.10 -| <> +| 2.31 |=== Checks for setup scattered across multiple hooks in an example group. From a1258f43b8f65a18a2ad611b94d9c4ba6ad4b615 Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Sun, 9 Jun 2024 19:33:50 +0200 Subject: [PATCH 2/4] Enable pending cops --- config/default.yml | 4 ++-- docs/modules/ROOT/pages/cops_rspec.adoc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/default.yml b/config/default.yml index 6d2c64027..62135b81d 100644 --- a/config/default.yml +++ b/config/default.yml @@ -659,8 +659,8 @@ RSpec/MissingExampleGroupArgument: RSpec/MissingExpectationTargetMethod: Description: Checks if `.to`, `not_to` or `to_not` are used. - Enabled: pending - VersionAdded: "<>" + Enabled: true + VersionAdded: '3.0' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExpectationTargetMethod RSpec/MultipleDescribes: diff --git a/docs/modules/ROOT/pages/cops_rspec.adoc b/docs/modules/ROOT/pages/cops_rspec.adoc index 83925346c..143791aa5 100644 --- a/docs/modules/ROOT/pages/cops_rspec.adoc +++ b/docs/modules/ROOT/pages/cops_rspec.adoc @@ -3411,10 +3411,10 @@ end |=== | Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed -| Pending +| Enabled | Yes | No -| <> +| 3.0 | - |=== From f41cd5a5f1349335bdcdf3f3a77a9c4d8b46db19 Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Wed, 5 Jun 2024 15:54:05 +0200 Subject: [PATCH 3/4] Remove already enabled cops from .rubocop.yml A lot of RSpec cops were recently changed from being pending to be enabled. This means we no longer need to explicitly enable them in our internal RuboCop config file. --- .rubocop.yml | 66 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 64 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b16148d1d..4795eec03 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -122,7 +122,6 @@ Style/RequireOrder: Enabled: true RSpec/SpecFilePathFormat: - Enabled: true Exclude: - spec/rubocop/cop/rspec/mixin/**/*.rb @@ -253,66 +252,5 @@ Style/SwapValues: {Enabled: true} Style/YAMLFileRead: {Enabled: true} # Enable our own pending cops. - -RSpec/BeEmpty: - Enabled: true -RSpec/BeEq: - Enabled: true -RSpec/BeNil: - Enabled: true -RSpec/ChangeByZero: - Enabled: true -RSpec/ClassCheck: - Enabled: true -RSpec/ContainExactly: - Enabled: true -RSpec/DuplicatedMetadata: - Enabled: true -RSpec/EmptyMetadata: - Enabled: true -RSpec/EmptyOutput: - Enabled: true -RSpec/Eq: - Enabled: true -RSpec/ExcessiveDocstringSpacing: - Enabled: true -RSpec/ExpectInLet: - Enabled: true -RSpec/IdenticalEqualityAssertion: - Enabled: true -RSpec/IndexedLet: - Enabled: true -RSpec/IsExpectedSpecify: - Enabled: true -RSpec/MatchArray: - Enabled: true -RSpec/MetadataStyle: - Enabled: true -RSpec/MissingExpectationTargetMethod: - Enabled: true -RSpec/NoExpectationExample: - Enabled: true -RSpec/PendingWithoutReason: - Enabled: true -RSpec/ReceiveMessages: - Enabled: true -RSpec/RedundantAround: - Enabled: true -RSpec/RedundantPredicateMatcher: - Enabled: true -RSpec/RemoveConst: - Enabled: true -RSpec/RepeatedSubjectCall: - Enabled: true -RSpec/SkipBlockInsideExample: - Enabled: true -RSpec/SortMetadata: - Enabled: true -RSpec/SpecFilePathSuffix: - Enabled: true -RSpec/SubjectDeclaration: - Enabled: true -RSpec/UndescriptiveLiteralsDescription: - Enabled: true -RSpec/VerifiedDoubleReference: - Enabled: true +# +# No pending cops yet. From 130655b5aeb744fe526b671be2cd96171eca7ffb Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Wed, 5 Jun 2024 10:44:06 +0200 Subject: [PATCH 4/4] Release v3.0.0.pre --- CHANGELOG.md | 4 ++++ docs/antora.yml | 2 +- lib/rubocop/rspec/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cf20afed..7af7df98c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Master (Unreleased) +## 3.0.0.pre (2024-06-05) + - Remove extracted cops in `Capybara`, `FactoryBot` and `Rails` departments. ([@ydah]) - Remove `RuboCop::RSpec::Language::NodePattern`. ([@ydah]) - Remove `RSpec/FilePath` cop. ([@ydah]) @@ -10,6 +12,8 @@ - Add new `RSpec/MissingExpectationTargetMethod` cop. ([@krororo]) - Fix an error for `RSpec/ScatteredSetup` when one of the hooks is an empty block. ([@earlopain]) +Read more about how to upgrade in https://docs.rubocop.org/rubocop-rspec/upgrade_to_version_3.html + ## 2.31.0 (2024-06-07) - Support `AutoCorrect: contextual` option for LSP. ([@ydah]) diff --git a/docs/antora.yml b/docs/antora.yml index 51a533a15..7b2f34b15 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -1,5 +1,5 @@ name: rubocop-rspec title: RuboCop RSpec -version: ~ +version: '3.0' nav: - modules/ROOT/nav.adoc diff --git a/lib/rubocop/rspec/version.rb b/lib/rubocop/rspec/version.rb index 001719a71..08861d37c 100644 --- a/lib/rubocop/rspec/version.rb +++ b/lib/rubocop/rspec/version.rb @@ -4,7 +4,7 @@ module RuboCop module RSpec # Version information for the RSpec RuboCop plugin. module Version - STRING = '2.29.2' + STRING = '3.0.0.pre' end end end