rubocop-rspec 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b642c03d2fb24a8ac19e4e9ea60b7db9267550533be56cf6bb01b79724f7ec5f
4
- data.tar.gz: 560dcc8a649c9556ea38021addb497c188eeb794432e307c13203bfe0d8d3d56
3
+ metadata.gz: a04549578a5df31cc51ccb63edef6de85bb5a02365f4004a916307df9b192d94
4
+ data.tar.gz: 4fc0209d17164239f1e86b32da80b665ef597cb95fd8d2b71dd822e05c0f1c9b
5
5
  SHA512:
6
- metadata.gz: 58f1eeb3b7a5c23629f76b87a4d1f66f1654bede0b59a4b8f9d7636f78d845850bf7518d87fac5a6daea2dda7bd13f844c59954ef231ce99a7cf310816891009
7
- data.tar.gz: 4646cb7db9590720e985fa24b7cec2908af6b0a5c4ae61b882587f189f95b705dbf8f0272d7d30f2d0af569e4ec8d2cee9a20ba8ada819c3948c6a29dd6b3962
6
+ metadata.gz: d0436f1c4ae1685ce24163a3a46ac70a157afbb438ca556f8e63f1b7b6f8280fcf8dfa2fcb4c0e88e408d5b3857fa129e6ddbbae1e75ebdfc5c3dc89dabbc482
7
+ data.tar.gz: aff4399bc8a47869e4e2e3e183933bf768ca09d84973c627b13650686c65844beb8db333ecda4341a66ac2c29c928cc30b374d946cc43c029acd3c62ec7fce03
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 3.0.2 (2024-07-02)
6
+
7
+ - Fix wrong autocorrect for `RSpec/ScatteredSetup` when hook contains heredoc. ([@earlopain])
8
+ - Fix false negative for `RSpec/PredicateMatcher` when expectation contains custom failure message. ([@earlopain])
9
+ - Facilitate the 3.0 upgrade flow with proper extracted cop messages. ([@jeppester])
10
+
5
11
  ## 3.0.1 (2024-06-11)
6
12
 
7
13
  - Bump RuboCop requirement to +1.61. ([@ydah])
@@ -933,6 +939,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
933
939
  [@jaredmoody]: https://github.com/jaredmoody
934
940
  [@jdufresne]: https://github.com/jdufresne
935
941
  [@jeffreyc]: https://github.com/jeffreyc
942
+ [@jeppester]: https://github.com/jeppester
936
943
  [@jessieay]: https://github.com/jessieay
937
944
  [@jfragoulis]: https://github.com/jfragoulis
938
945
  [@johnny-miyake]: https://github.com/johnny-miyake
data/README.md CHANGED
@@ -7,6 +7,15 @@
7
7
  [RSpec](https://rspec.info/)-specific analysis for your projects, as an extension to
8
8
  [RuboCop](https://github.com/rubocop/rubocop).
9
9
 
10
+ - [Installation](#installation)
11
+ - [Upgrading to RuboCop RSpec v3.x](#upgrading-to-rubocop-rspec-v3x)
12
+ - [Upgrading to RuboCop RSpec v2.x](#upgrading-to-rubocop-rspec-v2x)
13
+ - [Usage](#usage)
14
+ - [Documentation](#documentation)
15
+ - [The Cops](#the-cops)
16
+ - [Contributing](#contributing)
17
+ - [License](#license)
18
+
10
19
  ## Installation
11
20
 
12
21
  Just install the `rubocop-rspec` gem
@@ -21,6 +30,10 @@ or if you use bundler put this in your `Gemfile`
21
30
  gem 'rubocop-rspec', require: false
22
31
  ```
23
32
 
33
+ ### Upgrading to RuboCop RSpec v3.x
34
+
35
+ Read all the details in our [Upgrade to Version 3.x](https://docs.rubocop.org/rubocop-rspec/3.0/upgrade_to_version_3.html) document.
36
+
24
37
  ### Upgrading to RuboCop RSpec v2.x
25
38
 
26
39
  Read all the details in our [Upgrade to Version 2.x](https://docs.rubocop.org/rubocop-rspec/2.0/upgrade_to_version_2.html) document.
@@ -13,28 +13,6 @@ changed_parameters:
13
13
  alternative: AllowedPatterns
14
14
  severity: warning
15
15
 
16
- renamed:
17
- RSpec/Capybara/CurrentPathExpectation: Capybara/CurrentPathExpectation
18
- RSpec/Capybara/MatchStyle: Capybara/MatchStyle
19
- RSpec/Capybara/NegationMatcher: Capybara/NegationMatcher
20
- RSpec/Capybara/SpecificActions: Capybara/SpecificActions
21
- RSpec/Capybara/SpecificFinders: Capybara/SpecificFinders
22
- RSpec/Capybara/SpecificMatcher: Capybara/SpecificMatcher
23
- RSpec/Capybara/VisibilityMatcher: Capybara/VisibilityMatcher
24
- RSpec/FactoryBot/AttributeDefinedStatically: FactoryBot/AttributeDefinedStatically
25
- RSpec/FactoryBot/ConsistentParenthesesStyle: FactoryBot/ConsistentParenthesesStyle
26
- RSpec/FactoryBot/CreateList: FactoryBot/CreateList
27
- RSpec/FactoryBot/FactoryClassName: FactoryBot/FactoryClassName
28
- RSpec/FactoryBot/FactoryNameStyle: FactoryBot/FactoryNameStyle
29
- RSpec/FactoryBot/SyntaxMethods: FactoryBot/SyntaxMethods
30
- RSpec/Rails/AvoidSetupHook: RSpecRails/AvoidSetupHook
31
- RSpec/Rails/HaveHttpStatus: RSpecRails/HaveHttpStatus
32
- RSpec/Rails/HttpStatus: RSpecRails/HttpStatus
33
- RSpec/Rails/InferredSpecType: RSpecRails/InferredSpecType
34
- RSpec/Rails/MinitestAssertions: RSpecRails/MinitestAssertions
35
- RSpec/Rails/NegationBeValid: RSpecRails/NegationBeValid
36
- RSpec/Rails/TravelAround: RSpecRails/TravelAround
37
-
38
16
  split:
39
17
  RSpec/FilePath:
40
18
  alternatives:
@@ -45,3 +23,8 @@ removed:
45
23
  RSpec/Capybara/FeatureMethods:
46
24
  reason: >
47
25
  this cop has migrated to `RSpec/Dialect`. Please use `RSpec/Dialect` instead
26
+
27
+ extracted:
28
+ RSpec/Rails/*: rubocop-rspec_rails
29
+ RSpec/FactoryBot/*: rubocop-factory_bot
30
+ RSpec/Capybara/*: rubocop-capybara
@@ -32,7 +32,7 @@ module RuboCop
32
32
  (block $(send !nil? #predicate? ...) ...)
33
33
  $(send !nil? #predicate? ...)})
34
34
  $#Runners.all
35
- $#boolean_matcher?)
35
+ $#boolean_matcher? ...)
36
36
  PATTERN
37
37
 
38
38
  # @!method be_bool?(node)
@@ -183,8 +183,12 @@ module RuboCop
183
183
  (send
184
184
  (send nil? :expect $!nil?)
185
185
  #Runners.all
186
- {$(send nil? #predicate_matcher_name? ...)
187
- (block $(send nil? #predicate_matcher_name? ...) ...)})
186
+ {
187
+ $(send nil? #predicate_matcher_name? ...)
188
+ (block $(send nil? #predicate_matcher_name? ...) ...)
189
+ }
190
+ ...
191
+ )
188
192
  PATTERN
189
193
 
190
194
  # @!method predicate_matcher_block?(node)
@@ -23,6 +23,7 @@ module RuboCop
23
23
  # end
24
24
  #
25
25
  class ScatteredSetup < Base
26
+ include FinalEndLocation
26
27
  include RangeHelp
27
28
  extend AutoCorrector
28
29
 
@@ -75,8 +76,13 @@ module RuboCop
75
76
  def autocorrect(corrector, first_occurrence, occurrence)
76
77
  return if first_occurrence == occurrence || !first_occurrence.body
77
78
 
79
+ # Take heredocs into account
80
+ body = occurrence.body&.source_range&.with(
81
+ end_pos: final_end_location(occurrence).begin_pos
82
+ )
83
+
78
84
  corrector.insert_after(first_occurrence.body,
79
- "\n#{occurrence.body&.source}")
85
+ "\n#{body&.source}")
80
86
  corrector.remove(range_by_whole_lines(occurrence.source_range,
81
87
  include_final_newline: true))
82
88
  end
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module RSpec
5
5
  # Version information for the RSpec RuboCop plugin.
6
6
  module Version
7
- STRING = '3.0.1'
7
+ STRING = '3.0.2'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Backus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-06-11 00:00:00.000000000 Z
13
+ date: 2024-07-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  requirements: []
210
- rubygems_version: 3.5.9
210
+ rubygems_version: 3.5.11
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: Code style checking for RSpec files