rubocop-rspec 2.12.1 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +114 -86
- data/config/default.yml +44 -6
- data/config/obsoletion.yml +14 -0
- data/lib/rubocop/cop/rspec/align_left_let_brace.rb +8 -9
- data/lib/rubocop/cop/rspec/align_right_let_brace.rb +8 -9
- data/lib/rubocop/cop/rspec/any_instance.rb +1 -0
- data/lib/rubocop/cop/rspec/around_block.rb +26 -3
- data/lib/rubocop/cop/rspec/be.rb +0 -1
- data/lib/rubocop/cop/rspec/be_eq.rb +0 -1
- data/lib/rubocop/cop/rspec/be_eql.rb +0 -1
- data/lib/rubocop/cop/rspec/before_after_all.rb +1 -0
- data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +9 -3
- data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +2 -1
- data/lib/rubocop/cop/rspec/capybara/specific_finders.rb +86 -0
- data/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +91 -10
- data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +0 -1
- data/lib/rubocop/cop/rspec/change_by_zero.rb +60 -5
- data/lib/rubocop/cop/rspec/class_check.rb +101 -0
- data/lib/rubocop/cop/rspec/context_method.rb +2 -1
- data/lib/rubocop/cop/rspec/context_wording.rb +49 -18
- data/lib/rubocop/cop/rspec/describe_class.rb +1 -1
- data/lib/rubocop/cop/rspec/describe_method.rb +1 -0
- data/lib/rubocop/cop/rspec/described_class.rb +4 -14
- data/lib/rubocop/cop/rspec/dialect.rb +1 -0
- data/lib/rubocop/cop/rspec/empty_example_group.rb +19 -4
- data/lib/rubocop/cop/rspec/empty_hook.rb +2 -1
- data/lib/rubocop/cop/rspec/empty_line_after_example.rb +4 -9
- data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +2 -1
- data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +32 -2
- data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +2 -1
- data/lib/rubocop/cop/rspec/example_length.rb +2 -1
- data/lib/rubocop/cop/rspec/example_without_description.rb +2 -1
- data/lib/rubocop/cop/rspec/example_wording.rb +2 -1
- data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +1 -0
- data/lib/rubocop/cop/rspec/expect_actual.rb +3 -0
- data/lib/rubocop/cop/rspec/expect_change.rb +1 -1
- data/lib/rubocop/cop/rspec/expect_in_hook.rb +4 -1
- data/lib/rubocop/cop/rspec/expect_output.rb +1 -0
- data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +2 -1
- data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +26 -12
- data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +1 -0
- data/lib/rubocop/cop/rspec/file_path.rb +6 -3
- data/lib/rubocop/cop/rspec/focus.rb +18 -0
- data/lib/rubocop/cop/rspec/hook_argument.rb +7 -2
- data/lib/rubocop/cop/rspec/hooks_before_examples.rb +10 -9
- data/lib/rubocop/cop/rspec/identical_equality_assertion.rb +0 -1
- data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +1 -0
- data/lib/rubocop/cop/rspec/implicit_expect.rb +0 -2
- data/lib/rubocop/cop/rspec/instance_spy.rb +1 -1
- data/lib/rubocop/cop/rspec/instance_variable.rb +0 -1
- data/lib/rubocop/cop/rspec/it_behaves_like.rb +1 -0
- data/lib/rubocop/cop/rspec/iterated_expectation.rb +16 -0
- data/lib/rubocop/cop/rspec/leading_subject.rb +15 -15
- data/lib/rubocop/cop/rspec/let_before_examples.rb +7 -8
- data/lib/rubocop/cop/rspec/let_setup.rb +4 -4
- data/lib/rubocop/cop/rspec/message_chain.rb +1 -1
- data/lib/rubocop/cop/rspec/missing_example_group_argument.rb +2 -1
- data/lib/rubocop/cop/rspec/mixin/css_selector.rb +99 -0
- data/lib/rubocop/cop/rspec/mixin/namespace.rb +23 -0
- data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -0
- data/lib/rubocop/cop/rspec/multiple_expectations.rb +1 -5
- data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +1 -3
- data/lib/rubocop/cop/rspec/multiple_subjects.rb +17 -2
- data/lib/rubocop/cop/rspec/named_subject.rb +2 -1
- data/lib/rubocop/cop/rspec/nested_groups.rb +45 -25
- data/lib/rubocop/cop/rspec/no_expectation_example.rb +64 -0
- data/lib/rubocop/cop/rspec/not_to_not.rb +1 -2
- data/lib/rubocop/cop/rspec/overwriting_setup.rb +2 -1
- data/lib/rubocop/cop/rspec/pending.rb +1 -0
- data/lib/rubocop/cop/rspec/predicate_matcher.rb +2 -1
- data/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +1 -2
- data/lib/rubocop/cop/rspec/receive_counts.rb +14 -15
- data/lib/rubocop/cop/rspec/receive_never.rb +4 -5
- data/lib/rubocop/cop/rspec/repeated_description.rb +25 -26
- data/lib/rubocop/cop/rspec/repeated_example.rb +1 -1
- data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +28 -29
- data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +28 -29
- data/lib/rubocop/cop/rspec/repeated_include_example.rb +32 -33
- data/lib/rubocop/cop/rspec/return_from_stub.rb +1 -1
- data/lib/rubocop/cop/rspec/scattered_let.rb +1 -5
- data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
- data/lib/rubocop/cop/rspec/shared_context.rb +1 -1
- data/lib/rubocop/cop/rspec/stubbed_mock.rb +0 -1
- data/lib/rubocop/cop/rspec/subject_declaration.rb +0 -1
- data/lib/rubocop/cop/rspec/subject_stub.rb +2 -2
- data/lib/rubocop/cop/rspec/unspecified_exception.rb +15 -15
- data/lib/rubocop/cop/rspec/variable_definition.rb +1 -0
- data/lib/rubocop/cop/rspec/variable_name.rb +6 -7
- data/lib/rubocop/cop/rspec/verified_doubles.rb +1 -0
- data/lib/rubocop/cop/rspec/void_expect.rb +2 -1
- data/lib/rubocop/cop/rspec/yield.rb +2 -1
- data/lib/rubocop/cop/rspec_cops.rb +3 -0
- data/lib/rubocop/rspec/config_formatter.rb +14 -3
- data/lib/rubocop/rspec/inject.rb +1 -3
- data/lib/rubocop/rspec/language/node_pattern.rb +4 -0
- data/lib/rubocop/rspec/language.rb +6 -1
- data/lib/rubocop/rspec/version.rb +1 -1
- data/lib/rubocop/rspec/wording.rb +2 -2
- data/lib/rubocop/rspec.rb +14 -0
- data/lib/rubocop-rspec.rb +3 -0
- metadata +11 -88
@@ -21,17 +21,18 @@ module RuboCop
|
|
21
21
|
.gsub(EXTENSION_ROOT_DEPARTMENT, "\n\\1")
|
22
22
|
.gsub(*AMENDMENTS, "\n\\0")
|
23
23
|
.gsub(/^(\s+)- /, '\1 - ')
|
24
|
+
.gsub('"~"', '~')
|
24
25
|
end
|
25
26
|
|
26
27
|
private
|
27
28
|
|
28
29
|
def unified_config
|
29
30
|
cops.each_with_object(config.dup) do |cop, unified|
|
30
|
-
next if SUBDEPARTMENTS.include?(cop)
|
31
|
-
next if AMENDMENTS.include?(cop)
|
31
|
+
next if SUBDEPARTMENTS.include?(cop) || AMENDMENTS.include?(cop)
|
32
32
|
|
33
|
+
replace_nil(unified[cop])
|
33
34
|
unified[cop].merge!(descriptions.fetch(cop))
|
34
|
-
unified[cop]['Reference'] =
|
35
|
+
unified[cop]['Reference'] = reference(cop)
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -39,6 +40,16 @@ module RuboCop
|
|
39
40
|
(descriptions.keys | config.keys).grep(EXTENSION_ROOT_DEPARTMENT)
|
40
41
|
end
|
41
42
|
|
43
|
+
def replace_nil(config)
|
44
|
+
config.each do |key, value|
|
45
|
+
config[key] = '~' if value.nil?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def reference(cop)
|
50
|
+
COP_DOC_BASE_URL + cop.sub('RSpec/', '')
|
51
|
+
end
|
52
|
+
|
42
53
|
attr_reader :config, :descriptions
|
43
54
|
end
|
44
55
|
end
|
data/lib/rubocop/rspec/inject.rb
CHANGED
@@ -6,9 +6,7 @@ module RuboCop
|
|
6
6
|
# bit of our configuration.
|
7
7
|
module Inject
|
8
8
|
def self.defaults!
|
9
|
-
|
10
|
-
config_default = project_root.join('config', 'default.yml')
|
11
|
-
path = config_default.to_s
|
9
|
+
path = CONFIG_DEFAULT.to_s
|
12
10
|
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
13
11
|
config = RuboCop::Config.new(hash, path)
|
14
12
|
puts "configuration from #{path}" if ConfigLoader.debug?
|
@@ -41,7 +41,12 @@ module RuboCop
|
|
41
41
|
def_node_matcher :example?, block_pattern('#Examples.all')
|
42
42
|
|
43
43
|
# @!method hook?(node)
|
44
|
-
def_node_matcher :hook?,
|
44
|
+
def_node_matcher :hook?, <<-PATTERN
|
45
|
+
{
|
46
|
+
#{block_pattern('#Hooks.all')}
|
47
|
+
#{numblock_pattern('#Hooks.all')}
|
48
|
+
}
|
49
|
+
PATTERN
|
45
50
|
|
46
51
|
# @!method let?(node)
|
47
52
|
def_node_matcher :let?, <<-PATTERN
|
@@ -31,8 +31,8 @@ module RuboCop
|
|
31
31
|
attr_reader :text, :ignores, :replacements
|
32
32
|
|
33
33
|
def replace_prefix(pattern, replacement)
|
34
|
-
text.sub(pattern) do |
|
35
|
-
uppercase?(
|
34
|
+
text.sub(pattern) do |matched|
|
35
|
+
uppercase?(matched) ? replacement.upcase : replacement
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
# RuboCop RSpec project namespace
|
5
|
+
module RSpec
|
6
|
+
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
7
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
8
|
+
|
9
|
+
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
10
|
+
|
11
|
+
::RuboCop::ConfigObsoletion.files << PROJECT_ROOT.join('config',
|
12
|
+
'obsoletion.yml')
|
13
|
+
end
|
14
|
+
end
|
data/lib/rubocop-rspec.rb
CHANGED
@@ -5,6 +5,7 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
require 'rubocop'
|
7
7
|
|
8
|
+
require_relative 'rubocop/rspec'
|
8
9
|
require_relative 'rubocop/rspec/version'
|
9
10
|
require_relative 'rubocop/rspec/inject'
|
10
11
|
require_relative 'rubocop/rspec/node'
|
@@ -20,6 +21,8 @@ require_relative 'rubocop/cop/rspec/mixin/final_end_location'
|
|
20
21
|
require_relative 'rubocop/cop/rspec/mixin/comments_help'
|
21
22
|
require_relative 'rubocop/cop/rspec/mixin/empty_line_separation'
|
22
23
|
require_relative 'rubocop/cop/rspec/mixin/inside_example_group'
|
24
|
+
require_relative 'rubocop/cop/rspec/mixin/namespace'
|
25
|
+
require_relative 'rubocop/cop/rspec/mixin/css_selector'
|
23
26
|
|
24
27
|
require_relative 'rubocop/rspec/concept'
|
25
28
|
require_relative 'rubocop/rspec/example_group'
|
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: 2.
|
4
|
+
version: 2.13.1
|
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: 2022-
|
13
|
+
date: 2022-09-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -18,98 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '1.
|
21
|
+
version: '1.33'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '1.
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: rack
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '0'
|
36
|
-
type: :development
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '0'
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: rake
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0'
|
50
|
-
type: :development
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0'
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: rspec
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '3.4'
|
64
|
-
type: :development
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '3.4'
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: rubocop-performance
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - "~>"
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '1.7'
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - "~>"
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '1.7'
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: rubocop-rake
|
87
|
-
requirement: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - "~>"
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0.6'
|
92
|
-
type: :development
|
93
|
-
prerelease: false
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
requirements:
|
96
|
-
- - "~>"
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: '0.6'
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: yard
|
101
|
-
requirement: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '0'
|
106
|
-
type: :development
|
107
|
-
prerelease: false
|
108
|
-
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
requirements:
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0'
|
28
|
+
version: '1.33'
|
113
29
|
description: |2
|
114
30
|
Code style checking for RSpec files.
|
115
31
|
A plugin for the RuboCop code style enforcing & linting tool.
|
@@ -128,6 +44,7 @@ files:
|
|
128
44
|
- MIT-LICENSE.md
|
129
45
|
- README.md
|
130
46
|
- config/default.yml
|
47
|
+
- config/obsoletion.yml
|
131
48
|
- lib/rubocop-rspec.rb
|
132
49
|
- lib/rubocop/cop/rspec/align_left_let_brace.rb
|
133
50
|
- lib/rubocop/cop/rspec/align_right_let_brace.rb
|
@@ -141,9 +58,11 @@ files:
|
|
141
58
|
- lib/rubocop/cop/rspec/before_after_all.rb
|
142
59
|
- lib/rubocop/cop/rspec/capybara/current_path_expectation.rb
|
143
60
|
- lib/rubocop/cop/rspec/capybara/feature_methods.rb
|
61
|
+
- lib/rubocop/cop/rspec/capybara/specific_finders.rb
|
144
62
|
- lib/rubocop/cop/rspec/capybara/specific_matcher.rb
|
145
63
|
- lib/rubocop/cop/rspec/capybara/visibility_matcher.rb
|
146
64
|
- lib/rubocop/cop/rspec/change_by_zero.rb
|
65
|
+
- lib/rubocop/cop/rspec/class_check.rb
|
147
66
|
- lib/rubocop/cop/rspec/context_method.rb
|
148
67
|
- lib/rubocop/cop/rspec/context_wording.rb
|
149
68
|
- lib/rubocop/cop/rspec/describe_class.rb
|
@@ -192,9 +111,11 @@ files:
|
|
192
111
|
- lib/rubocop/cop/rspec/message_spies.rb
|
193
112
|
- lib/rubocop/cop/rspec/missing_example_group_argument.rb
|
194
113
|
- lib/rubocop/cop/rspec/mixin/comments_help.rb
|
114
|
+
- lib/rubocop/cop/rspec/mixin/css_selector.rb
|
195
115
|
- lib/rubocop/cop/rspec/mixin/empty_line_separation.rb
|
196
116
|
- lib/rubocop/cop/rspec/mixin/final_end_location.rb
|
197
117
|
- lib/rubocop/cop/rspec/mixin/inside_example_group.rb
|
118
|
+
- lib/rubocop/cop/rspec/mixin/namespace.rb
|
198
119
|
- lib/rubocop/cop/rspec/mixin/top_level_group.rb
|
199
120
|
- lib/rubocop/cop/rspec/mixin/variable.rb
|
200
121
|
- lib/rubocop/cop/rspec/multiple_describes.rb
|
@@ -203,6 +124,7 @@ files:
|
|
203
124
|
- lib/rubocop/cop/rspec/multiple_subjects.rb
|
204
125
|
- lib/rubocop/cop/rspec/named_subject.rb
|
205
126
|
- lib/rubocop/cop/rspec/nested_groups.rb
|
127
|
+
- lib/rubocop/cop/rspec/no_expectation_example.rb
|
206
128
|
- lib/rubocop/cop/rspec/not_to_not.rb
|
207
129
|
- lib/rubocop/cop/rspec/overwriting_setup.rb
|
208
130
|
- lib/rubocop/cop/rspec/pending.rb
|
@@ -234,6 +156,7 @@ files:
|
|
234
156
|
- lib/rubocop/cop/rspec/void_expect.rb
|
235
157
|
- lib/rubocop/cop/rspec/yield.rb
|
236
158
|
- lib/rubocop/cop/rspec_cops.rb
|
159
|
+
- lib/rubocop/rspec.rb
|
237
160
|
- lib/rubocop/rspec/align_let_brace.rb
|
238
161
|
- lib/rubocop/rspec/concept.rb
|
239
162
|
- lib/rubocop/rspec/config_formatter.rb
|