rubocop-rspec 3.8.0 → 3.10.0
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 +4 -4
- data/CHANGELOG.md +25 -0
- data/config/default.yml +22 -0
- data/lib/rubocop/cop/rspec/around_block.rb +22 -0
- data/lib/rubocop/cop/rspec/contain_exactly.rb +8 -22
- data/lib/rubocop/cop/rspec/context_method.rb +1 -1
- data/lib/rubocop/cop/rspec/context_wording.rb +1 -1
- data/lib/rubocop/cop/rspec/described_class.rb +3 -1
- data/lib/rubocop/cop/rspec/discarded_matcher.rb +113 -0
- data/lib/rubocop/cop/rspec/empty_example_group.rb +3 -2
- data/lib/rubocop/cop/rspec/empty_hook.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_example.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +7 -2
- data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +1 -0
- data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +1 -1
- data/lib/rubocop/cop/rspec/example_length.rb +1 -1
- data/lib/rubocop/cop/rspec/example_without_description.rb +1 -1
- data/lib/rubocop/cop/rspec/example_wording.rb +1 -1
- data/lib/rubocop/cop/rspec/expect_actual.rb +33 -13
- data/lib/rubocop/cop/rspec/expect_change.rb +1 -1
- data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -0
- data/lib/rubocop/cop/rspec/expect_in_let.rb +1 -1
- data/lib/rubocop/cop/rspec/hook_argument.rb +1 -0
- data/lib/rubocop/cop/rspec/hooks_before_examples.rb +1 -0
- data/lib/rubocop/cop/rspec/indexed_let.rb +1 -1
- data/lib/rubocop/cop/rspec/instance_spy.rb +1 -1
- data/lib/rubocop/cop/rspec/iterated_expectation.rb +13 -0
- data/lib/rubocop/cop/rspec/leading_subject.rb +1 -1
- data/lib/rubocop/cop/rspec/leaky_local_variable.rb +18 -0
- data/lib/rubocop/cop/rspec/let_before_examples.rb +1 -1
- data/lib/rubocop/cop/rspec/let_setup.rb +1 -1
- data/lib/rubocop/cop/rspec/match_with_simple_regex.rb +89 -0
- data/lib/rubocop/cop/rspec/missing_example_group_argument.rb +1 -1
- data/lib/rubocop/cop/rspec/mixin/inside_example.rb +16 -0
- data/lib/rubocop/cop/rspec/mixin/metadata.rb +1 -0
- data/lib/rubocop/cop/rspec/multiple_expectations.rb +1 -1
- data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +1 -1
- data/lib/rubocop/cop/rspec/multiple_subjects.rb +1 -1
- data/lib/rubocop/cop/rspec/named_subject.rb +1 -1
- data/lib/rubocop/cop/rspec/no_expectation_example.rb +1 -0
- data/lib/rubocop/cop/rspec/output.rb +78 -0
- data/lib/rubocop/cop/rspec/overwriting_setup.rb +1 -1
- data/lib/rubocop/cop/rspec/predicate_matcher.rb +1 -1
- data/lib/rubocop/cop/rspec/redundant_around.rb +1 -0
- data/lib/rubocop/cop/rspec/repeated_description.rb +1 -1
- data/lib/rubocop/cop/rspec/repeated_example.rb +1 -1
- data/lib/rubocop/cop/rspec/return_from_stub.rb +1 -1
- data/lib/rubocop/cop/rspec/scattered_let.rb +11 -5
- data/lib/rubocop/cop/rspec/scattered_setup.rb +12 -2
- data/lib/rubocop/cop/rspec/shared_context.rb +1 -1
- data/lib/rubocop/cop/rspec/skip_block_inside_example.rb +3 -6
- data/lib/rubocop/cop/rspec/spec_file_path_format.rb +17 -10
- data/lib/rubocop/cop/rspec/subject_declaration.rb +17 -1
- data/lib/rubocop/cop/rspec/undescriptive_literals_description.rb +1 -1
- data/lib/rubocop/cop/rspec/void_expect.rb +3 -5
- data/lib/rubocop/cop/rspec/yield.rb +1 -1
- data/lib/rubocop/cop/rspec_cops.rb +3 -0
- data/lib/rubocop/rspec/description_extractor.rb +1 -1
- data/lib/rubocop/rspec/hook.rb +13 -0
- data/lib/rubocop/rspec/version.rb +1 -1
- data/lib/rubocop-rspec.rb +1 -0
- metadata +28 -4
data/lib/rubocop/rspec/hook.rb
CHANGED
|
@@ -25,6 +25,13 @@ module RuboCop
|
|
|
25
25
|
scope.equal?(:each)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
def inside_class_method? # rubocop:disable Metrics/CyclomaticComplexity
|
|
29
|
+
parent = node.parent
|
|
30
|
+
return false unless parent
|
|
31
|
+
|
|
32
|
+
parent.defs_type? || (parent.def_type? && inside_class_self?(parent))
|
|
33
|
+
end
|
|
34
|
+
|
|
28
35
|
def scope
|
|
29
36
|
return :each if scope_argument&.hash_type?
|
|
30
37
|
|
|
@@ -76,6 +83,12 @@ module RuboCop
|
|
|
76
83
|
def scope_argument
|
|
77
84
|
node.send_node.first_argument
|
|
78
85
|
end
|
|
86
|
+
|
|
87
|
+
def inside_class_self?(node)
|
|
88
|
+
node.parent&.sclass_type? ||
|
|
89
|
+
(node.parent&.begin_type? && node.parent.parent&.sclass_type?) ||
|
|
90
|
+
false
|
|
91
|
+
end
|
|
79
92
|
end
|
|
80
93
|
end
|
|
81
94
|
end
|
data/lib/rubocop-rspec.rb
CHANGED
|
@@ -14,6 +14,7 @@ require_relative 'rubocop/rspec/wording'
|
|
|
14
14
|
|
|
15
15
|
require_relative 'rubocop/cop/rspec/mixin/file_help'
|
|
16
16
|
require_relative 'rubocop/cop/rspec/mixin/final_end_location'
|
|
17
|
+
require_relative 'rubocop/cop/rspec/mixin/inside_example'
|
|
17
18
|
require_relative 'rubocop/cop/rspec/mixin/inside_example_group'
|
|
18
19
|
require_relative 'rubocop/cop/rspec/mixin/location_help'
|
|
19
20
|
require_relative 'rubocop/cop/rspec/mixin/metadata'
|
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.
|
|
4
|
+
version: 3.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Backus
|
|
@@ -25,20 +25,40 @@ dependencies:
|
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '1.1'
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: regexp_parser
|
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '2.0'
|
|
35
|
+
type: :runtime
|
|
36
|
+
prerelease: false
|
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '2.0'
|
|
28
42
|
- !ruby/object:Gem::Dependency
|
|
29
43
|
name: rubocop
|
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
|
31
45
|
requirements:
|
|
32
46
|
- - "~>"
|
|
33
47
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '1.
|
|
48
|
+
version: '1.86'
|
|
49
|
+
- - ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: 1.86.2
|
|
35
52
|
type: :runtime
|
|
36
53
|
prerelease: false
|
|
37
54
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
55
|
requirements:
|
|
39
56
|
- - "~>"
|
|
40
57
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '1.
|
|
58
|
+
version: '1.86'
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 1.86.2
|
|
42
62
|
description: |
|
|
43
63
|
Code style checking for RSpec files.
|
|
44
64
|
A plugin for the RuboCop code style enforcing & linting tool.
|
|
@@ -81,6 +101,7 @@ files:
|
|
|
81
101
|
- lib/rubocop/cop/rspec/described_class.rb
|
|
82
102
|
- lib/rubocop/cop/rspec/described_class_module_wrapping.rb
|
|
83
103
|
- lib/rubocop/cop/rspec/dialect.rb
|
|
104
|
+
- lib/rubocop/cop/rspec/discarded_matcher.rb
|
|
84
105
|
- lib/rubocop/cop/rspec/duplicated_metadata.rb
|
|
85
106
|
- lib/rubocop/cop/rspec/empty_example_group.rb
|
|
86
107
|
- lib/rubocop/cop/rspec/empty_hook.rb
|
|
@@ -121,6 +142,7 @@ files:
|
|
|
121
142
|
- lib/rubocop/cop/rspec/let_before_examples.rb
|
|
122
143
|
- lib/rubocop/cop/rspec/let_setup.rb
|
|
123
144
|
- lib/rubocop/cop/rspec/match_array.rb
|
|
145
|
+
- lib/rubocop/cop/rspec/match_with_simple_regex.rb
|
|
124
146
|
- lib/rubocop/cop/rspec/message_chain.rb
|
|
125
147
|
- lib/rubocop/cop/rspec/message_expectation.rb
|
|
126
148
|
- lib/rubocop/cop/rspec/message_spies.rb
|
|
@@ -131,6 +153,7 @@ files:
|
|
|
131
153
|
- lib/rubocop/cop/rspec/mixin/empty_line_separation.rb
|
|
132
154
|
- lib/rubocop/cop/rspec/mixin/file_help.rb
|
|
133
155
|
- lib/rubocop/cop/rspec/mixin/final_end_location.rb
|
|
156
|
+
- lib/rubocop/cop/rspec/mixin/inside_example.rb
|
|
134
157
|
- lib/rubocop/cop/rspec/mixin/inside_example_group.rb
|
|
135
158
|
- lib/rubocop/cop/rspec/mixin/location_help.rb
|
|
136
159
|
- lib/rubocop/cop/rspec/mixin/metadata.rb
|
|
@@ -146,6 +169,7 @@ files:
|
|
|
146
169
|
- lib/rubocop/cop/rspec/nested_groups.rb
|
|
147
170
|
- lib/rubocop/cop/rspec/no_expectation_example.rb
|
|
148
171
|
- lib/rubocop/cop/rspec/not_to_not.rb
|
|
172
|
+
- lib/rubocop/cop/rspec/output.rb
|
|
149
173
|
- lib/rubocop/cop/rspec/overwriting_setup.rb
|
|
150
174
|
- lib/rubocop/cop/rspec/pending.rb
|
|
151
175
|
- lib/rubocop/cop/rspec/pending_without_reason.rb
|
|
@@ -222,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
222
246
|
- !ruby/object:Gem::Version
|
|
223
247
|
version: '0'
|
|
224
248
|
requirements: []
|
|
225
|
-
rubygems_version:
|
|
249
|
+
rubygems_version: 4.0.10
|
|
226
250
|
specification_version: 4
|
|
227
251
|
summary: Code style checking for RSpec files
|
|
228
252
|
test_files: []
|