diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c4ca72f5..a26378c60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Master (Unreleased) +- Support `AutoCorrect: contextual` option for LSP. ([@ydah]) + ## 2.30.0 (2024-06-03) - Add new `RSpec/ExpectInLet` cop. ([@yasu551]) diff --git a/config/default.yml b/config/default.yml index 02fe6ef6e..1f6db403b 100644 --- a/config/default.yml +++ b/config/default.yml @@ -147,7 +147,9 @@ RSpec/Be: RSpec/BeEmpty: Description: Prefer using `be_empty` when checking for an empty array. Enabled: pending + AutoCorrect: contextual VersionAdded: '2.20' + VersionChanged: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEmpty RSpec/BeEq: @@ -311,15 +313,18 @@ RSpec/DuplicatedMetadata: RSpec/EmptyExampleGroup: Description: Checks if an example group does not include any tests. Enabled: true + AutoCorrect: contextual SafeAutoCorrect: false VersionAdded: '1.7' - VersionChanged: '2.13' + VersionChanged: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup RSpec/EmptyHook: Description: Checks for empty before and after hooks. Enabled: true + AutoCorrect: contextual VersionAdded: '1.39' + VersionChanged: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook RSpec/EmptyLineAfterExample: @@ -363,7 +368,9 @@ RSpec/EmptyLineAfterSubject: RSpec/EmptyMetadata: Description: Avoid empty metadata hash. Enabled: pending + AutoCorrect: contextual VersionAdded: '2.24' + VersionChanged: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyMetadata RSpec/EmptyOutput: @@ -477,8 +484,9 @@ RSpec/FilePath: RSpec/Focus: Description: Checks if examples are focused. Enabled: true + AutoCorrect: contextual VersionAdded: '1.5' - VersionChanged: '2.1' + VersionChanged: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus RSpec/HookArgument: @@ -496,7 +504,9 @@ RSpec/HookArgument: RSpec/HooksBeforeExamples: Description: Checks for before/around/after hooks that come after an example. Enabled: true + AutoCorrect: contextual VersionAdded: '1.29' + VersionChanged: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples RSpec/IdenticalEqualityAssertion: @@ -602,8 +612,9 @@ RSpec/LeakyConstantDeclaration: RSpec/LetBeforeExamples: Description: Checks for `let` definitions that come after an example. Enabled: true + AutoCorrect: contextual VersionAdded: '1.16' - VersionChanged: '1.22' + VersionChanged: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples RSpec/LetSetup: @@ -853,14 +864,17 @@ RSpec/ReturnFromStub: RSpec/ScatteredLet: Description: Checks for let scattered across the example group. Enabled: true + AutoCorrect: contextual VersionAdded: '1.14' - VersionChanged: '1.39' + VersionChanged: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet RSpec/ScatteredSetup: Description: Checks for setup scattered across multiple hooks in an example group. Enabled: true + AutoCorrect: contextual VersionAdded: '1.10' + VersionChanged: "<>" 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 c0f1ff8ef..9883ee715 100644 --- a/docs/modules/ROOT/pages/cops_rspec.adoc +++ b/docs/modules/ROOT/pages/cops_rspec.adoc @@ -199,9 +199,9 @@ expect(foo).to be(true) | Pending | Yes -| Always +| Command-line only | 2.20 -| - +| <> |=== Prefer using `be_empty` when checking for an empty array. @@ -1140,9 +1140,9 @@ describe 'Something', :a | Enabled | Yes -| Always (Unsafe) +| Command-line only (Unsafe) | 1.7 -| 2.13 +| <> |=== Checks if an example group does not include any tests. @@ -1194,9 +1194,9 @@ end | Enabled | Yes -| Always +| Command-line only | 1.39 -| - +| <> |=== Checks for empty before and after hooks. @@ -1497,9 +1497,9 @@ let(:foo) { bar } | Pending | Yes -| Always +| Command-line only | 2.24 -| - +| <> |=== Avoid empty metadata hash. @@ -2223,9 +2223,9 @@ my_class_spec.rb # describe MyClass, '#method' | Enabled | Yes -| Always +| Command-line only | 1.5 -| 2.1 +| <> |=== Checks if examples are focused. @@ -2385,9 +2385,9 @@ end | Enabled | Yes -| Always +| Command-line only | 1.29 -| - +| <> |=== Checks for before/around/after hooks that come after an example. @@ -3140,9 +3140,9 @@ end | Enabled | Yes -| Always +| Command-line only | 1.16 -| 1.22 +| <> |=== Checks for `let` definitions that come after an example. @@ -5096,9 +5096,9 @@ allow(Foo).to receive(:bar).and_return(bar.baz) | Enabled | Yes -| Always +| Command-line only | 1.14 -| 1.39 +| <> |=== Checks for let scattered across the example group. @@ -5139,9 +5139,9 @@ end | Enabled | Yes -| Always +| Command-line only | 1.10 -| - +| <> |=== Checks for setup scattered across multiple hooks in an example group.