rubocop-rspec 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce22630f88fd7a9b996711a4af330a186471fdc8a6dd99b05830ad695a09118
|
4
|
+
data.tar.gz: 44a91f15e435ec623b2a25ae6e7b890772d7cf3066206f97b0ca1abf42c62c7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d6b6f4113c4fc5253dcd59525e348879ae5763d09bb416de752d037b3ee20c38774df54322a8c7abd4c21652b22e6c4ac708bce51a2f1df61fecb4aab9dc4ac
|
7
|
+
data.tar.gz: ec0278b64e0dc0ca9cf0e9558ae02224ea5a3360ee86380336b4bc07e134801e46011f5ef673586eac6b85557884b3d3986d05935b3255ba48c227ecd760227c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 3.0.5 (2024-09-07)
|
6
|
+
|
7
|
+
- Fix false-negative and error for `RSpec/MetadataStyle` when non-literal args are used in metadata in `EnforceStyle: hash`. ([@cbliard])
|
8
|
+
- Improve offense message for `RSpec/IndexedLet`. ([@earlopain])
|
9
|
+
|
10
|
+
## 3.0.4 (2024-08-05)
|
11
|
+
|
12
|
+
- Fix false-negative for `UnspecifiedException` when matcher is chained. ([@r7kamura])
|
13
|
+
|
5
14
|
## 3.0.3 (2024-07-12)
|
6
15
|
|
7
16
|
- Add support for Unicode RIGHT SINGLE QUOTATION MARK in `RSpec/ExampleWording`. ([@jdufresne])
|
@@ -907,6 +916,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
907
916
|
[@bquorning]: https://github.com/bquorning
|
908
917
|
[@brentwheeldon]: https://github.com/BrentWheeldon
|
909
918
|
[@brianhawley]: https://github.com/BrianHawley
|
919
|
+
[@cbliard]: https://github.com/cbliard
|
910
920
|
[@cfabianski]: https://github.com/cfabianski
|
911
921
|
[@clupprich]: https://github.com/clupprich
|
912
922
|
[@composerinteralia]: https://github.com/composerinteralia
|
@@ -48,8 +48,8 @@ module RuboCop
|
|
48
48
|
include AllowedIdentifiers
|
49
49
|
include AllowedPattern
|
50
50
|
|
51
|
-
MSG = 'This `let` statement uses index in its name.
|
52
|
-
'a meaningful name.'
|
51
|
+
MSG = 'This `let` statement uses `%<index>s` in its name. ' \
|
52
|
+
'Please give it a meaningful name.'
|
53
53
|
|
54
54
|
# @!method let_name(node)
|
55
55
|
def_node_matcher :let_name, <<~PATTERN
|
@@ -66,7 +66,8 @@ module RuboCop
|
|
66
66
|
return unless children
|
67
67
|
|
68
68
|
filter_indexed_lets(children).each do |let_node|
|
69
|
-
|
69
|
+
index = let_name(let_node)[INDEX_REGEX]
|
70
|
+
add_offense(let_node, message: format(MSG, index: index))
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
@@ -45,13 +45,8 @@ module RuboCop
|
|
45
45
|
PATTERN
|
46
46
|
|
47
47
|
def on_metadata(symbols, hash)
|
48
|
-
# RSpec example groups accept two string arguments. In such a case,
|
49
|
-
# the rspec_metadata matcher will interpret the second string
|
50
|
-
# argument as a metadata symbol.
|
51
|
-
symbols.shift if symbols.first&.str_type?
|
52
|
-
|
53
48
|
symbols.each do |symbol|
|
54
|
-
on_metadata_symbol(symbol)
|
49
|
+
on_metadata_symbol(symbol) if symbol.sym_type?
|
55
50
|
end
|
56
51
|
|
57
52
|
return unless hash
|
@@ -32,34 +32,39 @@ module RuboCop
|
|
32
32
|
#
|
33
33
|
class UnspecifiedException < Base
|
34
34
|
MSG = 'Specify the exception being captured'
|
35
|
-
RESTRICT_ON_SEND = %i[to].freeze
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
)
|
36
|
+
RESTRICT_ON_SEND = %i[
|
37
|
+
raise_exception
|
38
|
+
raise_error
|
39
|
+
].freeze
|
40
|
+
|
41
|
+
# @!method expect_to?(node)
|
42
|
+
def_node_matcher :expect_to?, <<~PATTERN
|
43
|
+
(send (block (send nil? :expect) ...) :to ...)
|
45
44
|
PATTERN
|
46
45
|
|
47
46
|
def on_send(node)
|
48
47
|
return unless empty_exception_matcher?(node)
|
49
48
|
|
50
|
-
add_offense(node
|
49
|
+
add_offense(node)
|
51
50
|
end
|
52
51
|
|
53
52
|
private
|
54
53
|
|
55
54
|
def empty_exception_matcher?(node)
|
56
|
-
|
57
|
-
end
|
55
|
+
return false if node.arguments? || node.block_literal?
|
58
56
|
|
59
|
-
|
60
|
-
return false unless
|
57
|
+
expect_to = find_expect_to(node)
|
58
|
+
return false unless expect_to
|
59
|
+
return false if expect_to.block_node&.arguments?
|
60
|
+
|
61
|
+
true
|
62
|
+
end
|
61
63
|
|
62
|
-
|
64
|
+
def find_expect_to(node)
|
65
|
+
node.each_ancestor(:send).find do |ancestor|
|
66
|
+
expect_to?(ancestor)
|
67
|
+
end
|
63
68
|
end
|
64
69
|
end
|
65
70
|
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.
|
4
|
+
version: 3.0.5
|
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-07
|
13
|
+
date: 2024-09-07 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.
|
210
|
+
rubygems_version: 3.5.16
|
211
211
|
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: Code style checking for RSpec files
|