rubocop-rspec 1.7.0 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +955 -79
  3. data/CODE_OF_CONDUCT.md +17 -0
  4. data/MIT-LICENSE.md +1 -2
  5. data/README.md +35 -35
  6. data/config/default.yml +940 -52
  7. data/config/obsoletion.yml +30 -0
  8. data/lib/rubocop/cop/rspec/align_left_let_brace.rb +49 -0
  9. data/lib/rubocop/cop/rspec/align_right_let_brace.rb +49 -0
  10. data/lib/rubocop/cop/rspec/any_instance.rb +10 -13
  11. data/lib/rubocop/cop/rspec/around_block.rb +97 -0
  12. data/lib/rubocop/cop/rspec/base.rb +26 -0
  13. data/lib/rubocop/cop/rspec/be.rb +39 -0
  14. data/lib/rubocop/cop/rspec/be_empty.rb +45 -0
  15. data/lib/rubocop/cop/rspec/be_eq.rb +47 -0
  16. data/lib/rubocop/cop/rspec/be_eql.rb +18 -15
  17. data/lib/rubocop/cop/rspec/be_nil.rb +74 -0
  18. data/lib/rubocop/cop/rspec/before_after_all.rb +45 -0
  19. data/lib/rubocop/cop/rspec/change_by_zero.rb +184 -0
  20. data/lib/rubocop/cop/rspec/class_check.rb +101 -0
  21. data/lib/rubocop/cop/rspec/contain_exactly.rb +56 -0
  22. data/lib/rubocop/cop/rspec/context_method.rb +57 -0
  23. data/lib/rubocop/cop/rspec/context_wording.rb +117 -0
  24. data/lib/rubocop/cop/rspec/describe_class.rb +52 -21
  25. data/lib/rubocop/cop/rspec/describe_method.rb +26 -11
  26. data/lib/rubocop/cop/rspec/describe_symbol.rb +37 -0
  27. data/lib/rubocop/cop/rspec/described_class.rb +181 -34
  28. data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +38 -0
  29. data/lib/rubocop/cop/rspec/dialect.rb +84 -0
  30. data/lib/rubocop/cop/rspec/duplicated_metadata.rb +58 -0
  31. data/lib/rubocop/cop/rspec/empty_example_group.rb +134 -47
  32. data/lib/rubocop/cop/rspec/empty_hook.rb +49 -0
  33. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +82 -0
  34. data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +42 -0
  35. data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +40 -0
  36. data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +82 -0
  37. data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +36 -0
  38. data/lib/rubocop/cop/rspec/empty_metadata.rb +46 -0
  39. data/lib/rubocop/cop/rspec/empty_output.rb +47 -0
  40. data/lib/rubocop/cop/rspec/eq.rb +47 -0
  41. data/lib/rubocop/cop/rspec/example_length.rb +38 -20
  42. data/lib/rubocop/cop/rspec/example_without_description.rb +98 -0
  43. data/lib/rubocop/cop/rspec/example_wording.rb +117 -27
  44. data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +110 -0
  45. data/lib/rubocop/cop/rspec/expect_actual.rb +46 -20
  46. data/lib/rubocop/cop/rspec/expect_change.rb +86 -0
  47. data/lib/rubocop/cop/rspec/expect_in_hook.rb +50 -0
  48. data/lib/rubocop/cop/rspec/expect_in_let.rb +42 -0
  49. data/lib/rubocop/cop/rspec/expect_output.rb +50 -0
  50. data/lib/rubocop/cop/rspec/focus.rb +79 -25
  51. data/lib/rubocop/cop/rspec/hook_argument.rb +48 -36
  52. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +81 -0
  53. data/lib/rubocop/cop/rspec/identical_equality_assertion.rb +37 -0
  54. data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +68 -0
  55. data/lib/rubocop/cop/rspec/implicit_expect.rb +100 -0
  56. data/lib/rubocop/cop/rspec/implicit_subject.rb +167 -0
  57. data/lib/rubocop/cop/rspec/indexed_let.rb +112 -0
  58. data/lib/rubocop/cop/rspec/instance_spy.rb +74 -0
  59. data/lib/rubocop/cop/rspec/instance_variable.rb +28 -14
  60. data/lib/rubocop/cop/rspec/is_expected_specify.rb +45 -0
  61. data/lib/rubocop/cop/rspec/it_behaves_like.rb +49 -0
  62. data/lib/rubocop/cop/rspec/iterated_expectation.rb +74 -0
  63. data/lib/rubocop/cop/rspec/leading_subject.rb +57 -29
  64. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +127 -0
  65. data/lib/rubocop/cop/rspec/let_before_examples.rb +101 -0
  66. data/lib/rubocop/cop/rspec/let_setup.rb +32 -16
  67. data/lib/rubocop/cop/rspec/match_array.rb +59 -0
  68. data/lib/rubocop/cop/rspec/message_chain.rb +10 -15
  69. data/lib/rubocop/cop/rspec/message_expectation.rb +12 -9
  70. data/lib/rubocop/cop/rspec/message_spies.rb +88 -0
  71. data/lib/rubocop/cop/rspec/metadata_style.rb +202 -0
  72. data/lib/rubocop/cop/rspec/missing_example_group_argument.rb +35 -0
  73. data/lib/rubocop/cop/rspec/missing_expectation_target_method.rb +54 -0
  74. data/lib/rubocop/cop/rspec/mixin/comments_help.rb +38 -0
  75. data/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb +59 -0
  76. data/lib/rubocop/cop/rspec/mixin/file_help.rb +14 -0
  77. data/lib/rubocop/cop/rspec/mixin/final_end_location.rb +19 -0
  78. data/lib/rubocop/cop/rspec/mixin/inside_example_group.rb +29 -0
  79. data/lib/rubocop/cop/rspec/mixin/location_help.rb +37 -0
  80. data/lib/rubocop/cop/rspec/mixin/metadata.rb +63 -0
  81. data/lib/rubocop/cop/rspec/mixin/namespace.rb +23 -0
  82. data/lib/rubocop/cop/rspec/mixin/skip_or_pending.rb +39 -0
  83. data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +54 -0
  84. data/lib/rubocop/cop/rspec/mixin/variable.rb +21 -0
  85. data/lib/rubocop/cop/rspec/multiple_describes.rb +14 -12
  86. data/lib/rubocop/cop/rspec/multiple_expectations.rb +86 -26
  87. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +146 -0
  88. data/lib/rubocop/cop/rspec/multiple_subjects.rb +97 -0
  89. data/lib/rubocop/cop/rspec/named_subject.rb +107 -27
  90. data/lib/rubocop/cop/rspec/nested_groups.rb +84 -47
  91. data/lib/rubocop/cop/rspec/no_expectation_example.rb +102 -0
  92. data/lib/rubocop/cop/rspec/not_to_not.rb +30 -27
  93. data/lib/rubocop/cop/rspec/overwriting_setup.rb +74 -0
  94. data/lib/rubocop/cop/rspec/pending.rb +80 -0
  95. data/lib/rubocop/cop/rspec/pending_without_reason.rb +159 -0
  96. data/lib/rubocop/cop/rspec/predicate_matcher.rb +341 -0
  97. data/lib/rubocop/cop/rspec/receive_counts.rb +89 -0
  98. data/lib/rubocop/cop/rspec/receive_messages.rb +161 -0
  99. data/lib/rubocop/cop/rspec/receive_never.rb +41 -0
  100. data/lib/rubocop/cop/rspec/redundant_around.rb +65 -0
  101. data/lib/rubocop/cop/rspec/redundant_predicate_matcher.rb +67 -0
  102. data/lib/rubocop/cop/rspec/remove_const.rb +39 -0
  103. data/lib/rubocop/cop/rspec/repeated_description.rb +98 -0
  104. data/lib/rubocop/cop/rspec/repeated_example.rb +53 -0
  105. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +100 -0
  106. data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +96 -0
  107. data/lib/rubocop/cop/rspec/repeated_include_example.rb +105 -0
  108. data/lib/rubocop/cop/rspec/repeated_subject_call.rb +125 -0
  109. data/lib/rubocop/cop/rspec/return_from_stub.rb +169 -0
  110. data/lib/rubocop/cop/rspec/scattered_let.rb +59 -0
  111. data/lib/rubocop/cop/rspec/scattered_setup.rb +92 -0
  112. data/lib/rubocop/cop/rspec/shared_context.rb +107 -0
  113. data/lib/rubocop/cop/rspec/shared_examples.rb +125 -0
  114. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +93 -0
  115. data/lib/rubocop/cop/rspec/skip_block_inside_example.rb +46 -0
  116. data/lib/rubocop/cop/rspec/sort_metadata.rb +71 -0
  117. data/lib/rubocop/cop/rspec/spec_file_path_format.rb +133 -0
  118. data/lib/rubocop/cop/rspec/spec_file_path_suffix.rb +40 -0
  119. data/lib/rubocop/cop/rspec/stubbed_mock.rb +176 -0
  120. data/lib/rubocop/cop/rspec/subject_declaration.rb +46 -0
  121. data/lib/rubocop/cop/rspec/subject_stub.rb +93 -74
  122. data/lib/rubocop/cop/rspec/undescriptive_literals_description.rb +69 -0
  123. data/lib/rubocop/cop/rspec/unspecified_exception.rb +67 -0
  124. data/lib/rubocop/cop/rspec/variable_definition.rb +77 -0
  125. data/lib/rubocop/cop/rspec/variable_name.rb +68 -0
  126. data/lib/rubocop/cop/rspec/verified_double_reference.rb +111 -0
  127. data/lib/rubocop/cop/rspec/verified_doubles.rb +28 -14
  128. data/lib/rubocop/cop/rspec/void_expect.rb +60 -0
  129. data/lib/rubocop/cop/rspec/yield.rb +82 -0
  130. data/lib/rubocop/cop/rspec_cops.rb +112 -0
  131. data/lib/rubocop/rspec/align_let_brace.rb +63 -0
  132. data/lib/rubocop/rspec/concept.rb +33 -0
  133. data/lib/rubocop/rspec/config_formatter.rb +27 -4
  134. data/lib/rubocop/rspec/cop/generator.rb +25 -0
  135. data/lib/rubocop/rspec/corrector/move_node.rb +51 -0
  136. data/lib/rubocop/rspec/description_extractor.rb +60 -18
  137. data/lib/rubocop/rspec/example.rb +37 -0
  138. data/lib/rubocop/rspec/example_group.rb +67 -0
  139. data/lib/rubocop/rspec/hook.rb +79 -0
  140. data/lib/rubocop/rspec/inject.rb +3 -1
  141. data/lib/rubocop/rspec/language.rb +184 -41
  142. data/lib/rubocop/rspec/node.rb +19 -0
  143. data/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb +29 -0
  144. data/lib/rubocop/rspec/version.rb +1 -1
  145. data/lib/rubocop/rspec/wording.rb +61 -19
  146. data/lib/rubocop/rspec.rb +6 -2
  147. data/lib/rubocop-rspec.rb +45 -34
  148. metadata +130 -195
  149. data/Gemfile +0 -13
  150. data/Rakefile +0 -48
  151. data/lib/rubocop/cop/rspec/file_path.rb +0 -83
  152. data/lib/rubocop/rspec/language/node_pattern.rb +0 -16
  153. data/lib/rubocop/rspec/spec_only.rb +0 -61
  154. data/lib/rubocop/rspec/top_level_describe.rb +0 -61
  155. data/lib/rubocop/rspec/util.rb +0 -19
  156. data/rubocop-rspec.gemspec +0 -42
  157. data/spec/expect_violation/expectation_spec.rb +0 -85
  158. data/spec/project/changelog_spec.rb +0 -81
  159. data/spec/project/default_config_spec.rb +0 -52
  160. data/spec/project/project_requires_spec.rb +0 -8
  161. data/spec/rubocop/cop/rspec/any_instance_spec.rb +0 -30
  162. data/spec/rubocop/cop/rspec/be_eql_spec.rb +0 -59
  163. data/spec/rubocop/cop/rspec/describe_class_spec.rb +0 -113
  164. data/spec/rubocop/cop/rspec/describe_method_spec.rb +0 -32
  165. data/spec/rubocop/cop/rspec/described_class_spec.rb +0 -219
  166. data/spec/rubocop/cop/rspec/empty_example_group_spec.rb +0 -79
  167. data/spec/rubocop/cop/rspec/example_length_spec.rb +0 -117
  168. data/spec/rubocop/cop/rspec/example_wording_spec.rb +0 -82
  169. data/spec/rubocop/cop/rspec/expect_actual_spec.rb +0 -136
  170. data/spec/rubocop/cop/rspec/file_path_spec.rb +0 -236
  171. data/spec/rubocop/cop/rspec/focus_spec.rb +0 -130
  172. data/spec/rubocop/cop/rspec/hook_argument_spec.rb +0 -189
  173. data/spec/rubocop/cop/rspec/instance_variable_spec.rb +0 -75
  174. data/spec/rubocop/cop/rspec/leading_subject_spec.rb +0 -54
  175. data/spec/rubocop/cop/rspec/let_setup_spec.rb +0 -66
  176. data/spec/rubocop/cop/rspec/message_chain_spec.rb +0 -21
  177. data/spec/rubocop/cop/rspec/message_expectation_spec.rb +0 -63
  178. data/spec/rubocop/cop/rspec/multiple_describes_spec.rb +0 -28
  179. data/spec/rubocop/cop/rspec/multiple_expectations_spec.rb +0 -84
  180. data/spec/rubocop/cop/rspec/named_subject_spec.rb +0 -62
  181. data/spec/rubocop/cop/rspec/nested_groups_spec.rb +0 -55
  182. data/spec/rubocop/cop/rspec/not_to_not_spec.rb +0 -57
  183. data/spec/rubocop/cop/rspec/subject_stub_spec.rb +0 -183
  184. data/spec/rubocop/cop/rspec/verified_doubles_spec.rb +0 -71
  185. data/spec/rubocop/rspec/config_formatter_spec.rb +0 -48
  186. data/spec/rubocop/rspec/description_extractor_spec.rb +0 -35
  187. data/spec/rubocop/rspec/language/selector_set_spec.rb +0 -29
  188. data/spec/rubocop/rspec/spec_only_spec.rb +0 -97
  189. data/spec/rubocop/rspec/util/one_spec.rb +0 -21
  190. data/spec/rubocop/rspec/wording_spec.rb +0 -44
  191. data/spec/shared/rspec_only_cop_behavior.rb +0 -68
  192. data/spec/spec_helper.rb +0 -41
  193. data/spec/support/expect_violation.rb +0 -166
metadata CHANGED
@@ -1,132 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
+ - John Backus
7
8
  - Ian MacLeod
8
9
  - Nils Gemeinhardt
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2016-08-24 00:00:00.000000000 Z
13
+ date: 2024-07-03 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rubocop
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
- - - ">="
19
+ - - "~>"
19
20
  - !ruby/object:Gem::Version
20
- version: 0.42.0
21
+ version: '1.61'
21
22
  type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
- - - ">="
26
+ - - "~>"
26
27
  - !ruby/object:Gem::Version
27
- version: 0.42.0
28
- - !ruby/object:Gem::Dependency
29
- name: rake
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: rspec
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '3.4'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '3.4'
56
- - !ruby/object:Gem::Dependency
57
- name: simplecov
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: anima
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: concord
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: adamantium
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '0'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: yard
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- description: |2
127
- Code style checking for RSpec files.
128
- A plugin for the RuboCop code style enforcing & linting tool.
28
+ version: '1.61'
29
+ description: |
30
+ Code style checking for RSpec files.
31
+ A plugin for the RuboCop code style enforcing & linting tool.
129
32
  email:
33
+ - johncbackus@gmail.com
130
34
  - ian@nevir.net
131
35
  - git@nilsgemeinhardt.de
132
36
  executables: []
@@ -136,89 +40,158 @@ extra_rdoc_files:
136
40
  - README.md
137
41
  files:
138
42
  - CHANGELOG.md
139
- - Gemfile
43
+ - CODE_OF_CONDUCT.md
140
44
  - MIT-LICENSE.md
141
45
  - README.md
142
- - Rakefile
143
46
  - config/default.yml
47
+ - config/obsoletion.yml
144
48
  - lib/rubocop-rspec.rb
49
+ - lib/rubocop/cop/rspec/align_left_let_brace.rb
50
+ - lib/rubocop/cop/rspec/align_right_let_brace.rb
145
51
  - lib/rubocop/cop/rspec/any_instance.rb
52
+ - lib/rubocop/cop/rspec/around_block.rb
53
+ - lib/rubocop/cop/rspec/base.rb
54
+ - lib/rubocop/cop/rspec/be.rb
55
+ - lib/rubocop/cop/rspec/be_empty.rb
56
+ - lib/rubocop/cop/rspec/be_eq.rb
146
57
  - lib/rubocop/cop/rspec/be_eql.rb
58
+ - lib/rubocop/cop/rspec/be_nil.rb
59
+ - lib/rubocop/cop/rspec/before_after_all.rb
60
+ - lib/rubocop/cop/rspec/change_by_zero.rb
61
+ - lib/rubocop/cop/rspec/class_check.rb
62
+ - lib/rubocop/cop/rspec/contain_exactly.rb
63
+ - lib/rubocop/cop/rspec/context_method.rb
64
+ - lib/rubocop/cop/rspec/context_wording.rb
147
65
  - lib/rubocop/cop/rspec/describe_class.rb
148
66
  - lib/rubocop/cop/rspec/describe_method.rb
67
+ - lib/rubocop/cop/rspec/describe_symbol.rb
149
68
  - lib/rubocop/cop/rspec/described_class.rb
69
+ - lib/rubocop/cop/rspec/described_class_module_wrapping.rb
70
+ - lib/rubocop/cop/rspec/dialect.rb
71
+ - lib/rubocop/cop/rspec/duplicated_metadata.rb
150
72
  - lib/rubocop/cop/rspec/empty_example_group.rb
73
+ - lib/rubocop/cop/rspec/empty_hook.rb
74
+ - lib/rubocop/cop/rspec/empty_line_after_example.rb
75
+ - lib/rubocop/cop/rspec/empty_line_after_example_group.rb
76
+ - lib/rubocop/cop/rspec/empty_line_after_final_let.rb
77
+ - lib/rubocop/cop/rspec/empty_line_after_hook.rb
78
+ - lib/rubocop/cop/rspec/empty_line_after_subject.rb
79
+ - lib/rubocop/cop/rspec/empty_metadata.rb
80
+ - lib/rubocop/cop/rspec/empty_output.rb
81
+ - lib/rubocop/cop/rspec/eq.rb
151
82
  - lib/rubocop/cop/rspec/example_length.rb
83
+ - lib/rubocop/cop/rspec/example_without_description.rb
152
84
  - lib/rubocop/cop/rspec/example_wording.rb
85
+ - lib/rubocop/cop/rspec/excessive_docstring_spacing.rb
153
86
  - lib/rubocop/cop/rspec/expect_actual.rb
154
- - lib/rubocop/cop/rspec/file_path.rb
87
+ - lib/rubocop/cop/rspec/expect_change.rb
88
+ - lib/rubocop/cop/rspec/expect_in_hook.rb
89
+ - lib/rubocop/cop/rspec/expect_in_let.rb
90
+ - lib/rubocop/cop/rspec/expect_output.rb
155
91
  - lib/rubocop/cop/rspec/focus.rb
156
92
  - lib/rubocop/cop/rspec/hook_argument.rb
93
+ - lib/rubocop/cop/rspec/hooks_before_examples.rb
94
+ - lib/rubocop/cop/rspec/identical_equality_assertion.rb
95
+ - lib/rubocop/cop/rspec/implicit_block_expectation.rb
96
+ - lib/rubocop/cop/rspec/implicit_expect.rb
97
+ - lib/rubocop/cop/rspec/implicit_subject.rb
98
+ - lib/rubocop/cop/rspec/indexed_let.rb
99
+ - lib/rubocop/cop/rspec/instance_spy.rb
157
100
  - lib/rubocop/cop/rspec/instance_variable.rb
101
+ - lib/rubocop/cop/rspec/is_expected_specify.rb
102
+ - lib/rubocop/cop/rspec/it_behaves_like.rb
103
+ - lib/rubocop/cop/rspec/iterated_expectation.rb
158
104
  - lib/rubocop/cop/rspec/leading_subject.rb
105
+ - lib/rubocop/cop/rspec/leaky_constant_declaration.rb
106
+ - lib/rubocop/cop/rspec/let_before_examples.rb
159
107
  - lib/rubocop/cop/rspec/let_setup.rb
108
+ - lib/rubocop/cop/rspec/match_array.rb
160
109
  - lib/rubocop/cop/rspec/message_chain.rb
161
110
  - lib/rubocop/cop/rspec/message_expectation.rb
111
+ - lib/rubocop/cop/rspec/message_spies.rb
112
+ - lib/rubocop/cop/rspec/metadata_style.rb
113
+ - lib/rubocop/cop/rspec/missing_example_group_argument.rb
114
+ - lib/rubocop/cop/rspec/missing_expectation_target_method.rb
115
+ - lib/rubocop/cop/rspec/mixin/comments_help.rb
116
+ - lib/rubocop/cop/rspec/mixin/empty_line_separation.rb
117
+ - lib/rubocop/cop/rspec/mixin/file_help.rb
118
+ - lib/rubocop/cop/rspec/mixin/final_end_location.rb
119
+ - lib/rubocop/cop/rspec/mixin/inside_example_group.rb
120
+ - lib/rubocop/cop/rspec/mixin/location_help.rb
121
+ - lib/rubocop/cop/rspec/mixin/metadata.rb
122
+ - lib/rubocop/cop/rspec/mixin/namespace.rb
123
+ - lib/rubocop/cop/rspec/mixin/skip_or_pending.rb
124
+ - lib/rubocop/cop/rspec/mixin/top_level_group.rb
125
+ - lib/rubocop/cop/rspec/mixin/variable.rb
162
126
  - lib/rubocop/cop/rspec/multiple_describes.rb
163
127
  - lib/rubocop/cop/rspec/multiple_expectations.rb
128
+ - lib/rubocop/cop/rspec/multiple_memoized_helpers.rb
129
+ - lib/rubocop/cop/rspec/multiple_subjects.rb
164
130
  - lib/rubocop/cop/rspec/named_subject.rb
165
131
  - lib/rubocop/cop/rspec/nested_groups.rb
132
+ - lib/rubocop/cop/rspec/no_expectation_example.rb
166
133
  - lib/rubocop/cop/rspec/not_to_not.rb
134
+ - lib/rubocop/cop/rspec/overwriting_setup.rb
135
+ - lib/rubocop/cop/rspec/pending.rb
136
+ - lib/rubocop/cop/rspec/pending_without_reason.rb
137
+ - lib/rubocop/cop/rspec/predicate_matcher.rb
138
+ - lib/rubocop/cop/rspec/receive_counts.rb
139
+ - lib/rubocop/cop/rspec/receive_messages.rb
140
+ - lib/rubocop/cop/rspec/receive_never.rb
141
+ - lib/rubocop/cop/rspec/redundant_around.rb
142
+ - lib/rubocop/cop/rspec/redundant_predicate_matcher.rb
143
+ - lib/rubocop/cop/rspec/remove_const.rb
144
+ - lib/rubocop/cop/rspec/repeated_description.rb
145
+ - lib/rubocop/cop/rspec/repeated_example.rb
146
+ - lib/rubocop/cop/rspec/repeated_example_group_body.rb
147
+ - lib/rubocop/cop/rspec/repeated_example_group_description.rb
148
+ - lib/rubocop/cop/rspec/repeated_include_example.rb
149
+ - lib/rubocop/cop/rspec/repeated_subject_call.rb
150
+ - lib/rubocop/cop/rspec/return_from_stub.rb
151
+ - lib/rubocop/cop/rspec/scattered_let.rb
152
+ - lib/rubocop/cop/rspec/scattered_setup.rb
153
+ - lib/rubocop/cop/rspec/shared_context.rb
154
+ - lib/rubocop/cop/rspec/shared_examples.rb
155
+ - lib/rubocop/cop/rspec/single_argument_message_chain.rb
156
+ - lib/rubocop/cop/rspec/skip_block_inside_example.rb
157
+ - lib/rubocop/cop/rspec/sort_metadata.rb
158
+ - lib/rubocop/cop/rspec/spec_file_path_format.rb
159
+ - lib/rubocop/cop/rspec/spec_file_path_suffix.rb
160
+ - lib/rubocop/cop/rspec/stubbed_mock.rb
161
+ - lib/rubocop/cop/rspec/subject_declaration.rb
167
162
  - lib/rubocop/cop/rspec/subject_stub.rb
163
+ - lib/rubocop/cop/rspec/undescriptive_literals_description.rb
164
+ - lib/rubocop/cop/rspec/unspecified_exception.rb
165
+ - lib/rubocop/cop/rspec/variable_definition.rb
166
+ - lib/rubocop/cop/rspec/variable_name.rb
167
+ - lib/rubocop/cop/rspec/verified_double_reference.rb
168
168
  - lib/rubocop/cop/rspec/verified_doubles.rb
169
+ - lib/rubocop/cop/rspec/void_expect.rb
170
+ - lib/rubocop/cop/rspec/yield.rb
171
+ - lib/rubocop/cop/rspec_cops.rb
169
172
  - lib/rubocop/rspec.rb
173
+ - lib/rubocop/rspec/align_let_brace.rb
174
+ - lib/rubocop/rspec/concept.rb
170
175
  - lib/rubocop/rspec/config_formatter.rb
176
+ - lib/rubocop/rspec/cop/generator.rb
177
+ - lib/rubocop/rspec/corrector/move_node.rb
171
178
  - lib/rubocop/rspec/description_extractor.rb
179
+ - lib/rubocop/rspec/example.rb
180
+ - lib/rubocop/rspec/example_group.rb
181
+ - lib/rubocop/rspec/hook.rb
172
182
  - lib/rubocop/rspec/inject.rb
173
183
  - lib/rubocop/rspec/language.rb
174
- - lib/rubocop/rspec/language/node_pattern.rb
175
- - lib/rubocop/rspec/spec_only.rb
176
- - lib/rubocop/rspec/top_level_describe.rb
177
- - lib/rubocop/rspec/util.rb
184
+ - lib/rubocop/rspec/node.rb
185
+ - lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
178
186
  - lib/rubocop/rspec/version.rb
179
187
  - lib/rubocop/rspec/wording.rb
180
- - rubocop-rspec.gemspec
181
- - spec/expect_violation/expectation_spec.rb
182
- - spec/project/changelog_spec.rb
183
- - spec/project/default_config_spec.rb
184
- - spec/project/project_requires_spec.rb
185
- - spec/rubocop/cop/rspec/any_instance_spec.rb
186
- - spec/rubocop/cop/rspec/be_eql_spec.rb
187
- - spec/rubocop/cop/rspec/describe_class_spec.rb
188
- - spec/rubocop/cop/rspec/describe_method_spec.rb
189
- - spec/rubocop/cop/rspec/described_class_spec.rb
190
- - spec/rubocop/cop/rspec/empty_example_group_spec.rb
191
- - spec/rubocop/cop/rspec/example_length_spec.rb
192
- - spec/rubocop/cop/rspec/example_wording_spec.rb
193
- - spec/rubocop/cop/rspec/expect_actual_spec.rb
194
- - spec/rubocop/cop/rspec/file_path_spec.rb
195
- - spec/rubocop/cop/rspec/focus_spec.rb
196
- - spec/rubocop/cop/rspec/hook_argument_spec.rb
197
- - spec/rubocop/cop/rspec/instance_variable_spec.rb
198
- - spec/rubocop/cop/rspec/leading_subject_spec.rb
199
- - spec/rubocop/cop/rspec/let_setup_spec.rb
200
- - spec/rubocop/cop/rspec/message_chain_spec.rb
201
- - spec/rubocop/cop/rspec/message_expectation_spec.rb
202
- - spec/rubocop/cop/rspec/multiple_describes_spec.rb
203
- - spec/rubocop/cop/rspec/multiple_expectations_spec.rb
204
- - spec/rubocop/cop/rspec/named_subject_spec.rb
205
- - spec/rubocop/cop/rspec/nested_groups_spec.rb
206
- - spec/rubocop/cop/rspec/not_to_not_spec.rb
207
- - spec/rubocop/cop/rspec/subject_stub_spec.rb
208
- - spec/rubocop/cop/rspec/verified_doubles_spec.rb
209
- - spec/rubocop/rspec/config_formatter_spec.rb
210
- - spec/rubocop/rspec/description_extractor_spec.rb
211
- - spec/rubocop/rspec/language/selector_set_spec.rb
212
- - spec/rubocop/rspec/spec_only_spec.rb
213
- - spec/rubocop/rspec/util/one_spec.rb
214
- - spec/rubocop/rspec/wording_spec.rb
215
- - spec/shared/rspec_only_cop_behavior.rb
216
- - spec/spec_helper.rb
217
- - spec/support/expect_violation.rb
218
- homepage: http://github.com/nevir/rubocop-rspec
188
+ homepage: https://github.com/rubocop/rubocop-rspec
219
189
  licenses:
220
190
  - MIT
221
- metadata: {}
191
+ metadata:
192
+ changelog_uri: https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md
193
+ documentation_uri: https://docs.rubocop.org/rubocop-rspec/
194
+ rubygems_mfa_required: 'true'
222
195
  post_install_message:
223
196
  rdoc_options: []
224
197
  require_paths:
@@ -227,53 +200,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
227
200
  requirements:
228
201
  - - ">="
229
202
  - !ruby/object:Gem::Version
230
- version: 2.2.0
203
+ version: 2.7.0
231
204
  required_rubygems_version: !ruby/object:Gem::Requirement
232
205
  requirements:
233
206
  - - ">="
234
207
  - !ruby/object:Gem::Version
235
208
  version: '0'
236
209
  requirements: []
237
- rubyforge_project:
238
- rubygems_version: 2.6.6
210
+ rubygems_version: 3.5.11
239
211
  signing_key:
240
212
  specification_version: 4
241
213
  summary: Code style checking for RSpec files
242
- test_files:
243
- - spec/expect_violation/expectation_spec.rb
244
- - spec/project/changelog_spec.rb
245
- - spec/project/default_config_spec.rb
246
- - spec/project/project_requires_spec.rb
247
- - spec/rubocop/cop/rspec/any_instance_spec.rb
248
- - spec/rubocop/cop/rspec/be_eql_spec.rb
249
- - spec/rubocop/cop/rspec/describe_class_spec.rb
250
- - spec/rubocop/cop/rspec/describe_method_spec.rb
251
- - spec/rubocop/cop/rspec/described_class_spec.rb
252
- - spec/rubocop/cop/rspec/empty_example_group_spec.rb
253
- - spec/rubocop/cop/rspec/example_length_spec.rb
254
- - spec/rubocop/cop/rspec/example_wording_spec.rb
255
- - spec/rubocop/cop/rspec/expect_actual_spec.rb
256
- - spec/rubocop/cop/rspec/file_path_spec.rb
257
- - spec/rubocop/cop/rspec/focus_spec.rb
258
- - spec/rubocop/cop/rspec/hook_argument_spec.rb
259
- - spec/rubocop/cop/rspec/instance_variable_spec.rb
260
- - spec/rubocop/cop/rspec/leading_subject_spec.rb
261
- - spec/rubocop/cop/rspec/let_setup_spec.rb
262
- - spec/rubocop/cop/rspec/message_chain_spec.rb
263
- - spec/rubocop/cop/rspec/message_expectation_spec.rb
264
- - spec/rubocop/cop/rspec/multiple_describes_spec.rb
265
- - spec/rubocop/cop/rspec/multiple_expectations_spec.rb
266
- - spec/rubocop/cop/rspec/named_subject_spec.rb
267
- - spec/rubocop/cop/rspec/nested_groups_spec.rb
268
- - spec/rubocop/cop/rspec/not_to_not_spec.rb
269
- - spec/rubocop/cop/rspec/subject_stub_spec.rb
270
- - spec/rubocop/cop/rspec/verified_doubles_spec.rb
271
- - spec/rubocop/rspec/config_formatter_spec.rb
272
- - spec/rubocop/rspec/description_extractor_spec.rb
273
- - spec/rubocop/rspec/language/selector_set_spec.rb
274
- - spec/rubocop/rspec/spec_only_spec.rb
275
- - spec/rubocop/rspec/util/one_spec.rb
276
- - spec/rubocop/rspec/wording_spec.rb
277
- - spec/shared/rspec_only_cop_behavior.rb
278
- - spec/spec_helper.rb
279
- - spec/support/expect_violation.rb
214
+ test_files: []
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :test do
6
- gem 'codeclimate-test-reporter', require: false
7
- end
8
-
9
- local_gemfile = 'Gemfile.local'
10
-
11
- if File.exist?(local_gemfile)
12
- eval(File.read(local_gemfile)) # rubocop:disable Lint/Eval
13
- end
data/Rakefile DELETED
@@ -1,48 +0,0 @@
1
- require 'open3'
2
-
3
- require 'bundler'
4
- require 'bundler/gem_tasks'
5
-
6
- begin
7
- Bundler.setup(:default, :development)
8
- rescue Bundler::BundlerError => e
9
- $stderr.puts e.message
10
- $stderr.puts 'Run `bundle install` to install missing gems'
11
- exit e.status_code
12
- end
13
-
14
- require 'rspec/core/rake_task'
15
- RSpec::Core::RakeTask.new(:spec) do |spec|
16
- spec.pattern = FileList['spec/**/*_spec.rb']
17
- end
18
-
19
- desc 'Run RSpec with code coverage'
20
- task :coverage do
21
- ENV['COVERAGE'] = 'true'
22
- Rake::Task['spec'].execute
23
- end
24
-
25
- desc 'Run RuboCop over this gem'
26
- task :internal_investigation do
27
- require 'rubocop-rspec'
28
-
29
- result = RuboCop::CLI.new.run
30
- abort('RuboCop failed!') unless result.zero?
31
- end
32
-
33
- desc 'Build config/default.yml'
34
- task :build_config do
35
- sh('bin/build_config')
36
- end
37
-
38
- desc 'Confirm config/default.yml is up to date'
39
- task confirm_config: :build_config do
40
- _, stdout, _, process =
41
- Open3.popen3('git diff --exit-code config/default.yml')
42
-
43
- unless process.value.success?
44
- raise "default.yml is out of sync:\n\n#{stdout.read}\nRun bin/build_config"
45
- end
46
- end
47
-
48
- task default: [:build_config, :spec, :internal_investigation, :confirm_config]
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module RSpec
6
- # Checks that spec file paths are consistent with the test subject.
7
- #
8
- # Checks the path of the spec file and enforces that it reflects the
9
- # described class/module and its optionally called out method.
10
- #
11
- # With the configuration option `CustomTransform` modules or classes can
12
- # be specified that should not as usual be transformed from CamelCase to
13
- # snake_case (e.g. 'RuboCop' => 'rubocop' ).
14
- #
15
- # @example
16
- # my_class/method_spec.rb # describe MyClass, '#method'
17
- # my_class_method_spec.rb # describe MyClass, '#method'
18
- # my_class_spec.rb # describe MyClass
19
- class FilePath < Cop
20
- include RuboCop::RSpec::SpecOnly, RuboCop::RSpec::TopLevelDescribe
21
-
22
- MESSAGE = 'Spec path should end with `%s`'.freeze
23
- METHOD_STRING_MATCHER = /^[\#\.].+/
24
- ROUTING_PAIR = s(:pair, s(:sym, :type), s(:sym, :routing))
25
-
26
- def on_top_level_describe(node, args)
27
- return if routing_spec?(args)
28
-
29
- return unless single_top_level_describe?
30
- object = args.first.const_name
31
- return unless object
32
-
33
- path_matcher = matcher(object, args.at(1))
34
- return if source_filename =~ regexp_from_glob(path_matcher)
35
-
36
- add_offense(node, :expression, format(MESSAGE, path_matcher))
37
- end
38
-
39
- private
40
-
41
- def routing_spec?(args)
42
- args.any? do |arg|
43
- arg.children.include?(ROUTING_PAIR)
44
- end
45
- end
46
-
47
- def matcher(object, method)
48
- path = File.join(parts(object))
49
- if method && method.type.equal?(:str)
50
- path += '*' + method.str_content.gsub(/\W+/, '')
51
- end
52
-
53
- "#{path}*_spec.rb"
54
- end
55
-
56
- def parts(object)
57
- object.split('::').map do |p|
58
- custom_transform[p] || camel_to_underscore(p)
59
- end
60
- end
61
-
62
- def source_filename
63
- processed_source.buffer.name
64
- end
65
-
66
- def camel_to_underscore(string)
67
- string
68
- .gsub(/([^A-Z])([A-Z]+)/, '\\1_\\2')
69
- .gsub(/([A-Z])([A-Z\d][^A-Z\d]+)/, '\\1_\\2')
70
- .downcase
71
- end
72
-
73
- def regexp_from_glob(glob)
74
- Regexp.new(glob.sub('.', '\\.').gsub('*', '.*') + '$')
75
- end
76
-
77
- def custom_transform
78
- cop_config['CustomTransform'] || {}
79
- end
80
- end
81
- end
82
- end
83
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- module Language
6
- # Common node matchers used for matching against the rspec DSL
7
- module NodePattern
8
- extend RuboCop::NodePattern::Macros
9
-
10
- def_node_matcher :example_group?, <<-PATTERN
11
- (block (send _ {#{ExampleGroups::ALL.to_node_pattern}} ...) ...)
12
- PATTERN
13
- end
14
- end
15
- end
16
- end
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- # Mixin for cops that skips non-spec files
6
- #
7
- # The criteria for whether rubocop-rspec analyzes a certain ruby file
8
- # is configured via `AllCops/RSpec`. For example, if you want to
9
- # customize your project to scan all files within a `test/` directory
10
- # then you could add this to your configuration:
11
- #
12
- # @example configuring analyzed paths
13
- #
14
- # AllCops:
15
- # RSpec:
16
- # Patterns:
17
- # - '_spec.rb$'
18
- # - '(?:^|/)spec/'
19
- #
20
- # @note this functionality is implemented via this mixin instead of
21
- # a subclass of `RuboCop::Cop::Cop` because the `Cop` class assumes
22
- # that it will be the direct superclass of all cops. For example,
23
- # if the ancestry of a cop looked like this:
24
- #
25
- # class RuboCop::RSpec::Cop < RuboCop::Cop::Cop
26
- # end
27
- #
28
- # class RuboCop::RSpec::SpecCop < RuboCop::RSpec::Cop
29
- # end
30
- #
31
- # then `SpecCop` will fail to be registered on the class instance
32
- # variable of `Cop` which tracks all descendants via `.inherited`.
33
- #
34
- # While we could match this behavior and provide a rubocop-rspec Cop
35
- # parent class, it would rely heavily on the implementation details
36
- # of RuboCop itself which is largly private API. This would be
37
- # irresponsible since any patch level release of rubocop could break
38
- # integrations for users of rubocop-rspec
39
- #
40
- module SpecOnly
41
- DEFAULT_CONFIGURATION = CONFIG.fetch('AllCops').fetch('RSpec')
42
-
43
- def relevant_file?(file)
44
- rspec_pattern =~ file && super
45
- end
46
-
47
- private
48
-
49
- def rspec_pattern
50
- Regexp.union(rspec_pattern_config.map(&Regexp.public_method(:new)))
51
- end
52
-
53
- def rspec_pattern_config
54
- config
55
- .for_all_cops
56
- .fetch('RSpec', DEFAULT_CONFIGURATION)
57
- .fetch('Patterns')
58
- end
59
- end
60
- end
61
- end