gitlab-styles 10.0.0 → 11.0.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/.gitignore +3 -3
- data/.gitlab/merge_request_templates/Release.md +18 -5
- data/.gitlab-ci.yml +3 -0
- data/.rubocop.yml +5 -1
- data/.rubocop_todo.yml +25 -1
- data/Gemfile +0 -16
- data/Gemfile.lock +233 -0
- data/README.md +2 -2
- data/gitlab-styles.gemspec +10 -3
- data/lib/gitlab/styles/rubocop/migration_helpers.rb +1 -1
- data/lib/gitlab/styles/version.rb +1 -1
- data/lib/rubocop/cop/custom_error_class.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/missing_cop_department.rb +80 -0
- data/lib/rubocop/cop/internal_affairs/use_restrict_on_send.rb +99 -0
- data/lib/rubocop/cop/line_break_after_guard_clauses.rb +1 -1
- data/lib/rubocop/cop/line_break_around_conditional_block.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_shared_example.rb +9 -2
- data/lib/rubocop/cop/rspec/example_starting_character.rb +1 -1
- data/lib/rubocop/cop/rspec/factory_bot/excessive_create_list.rb +52 -0
- data/lib/rubocop/cop/rspec/specify_expected.rb +49 -0
- data/lib/rubocop/cop/rspec/useless_dynamic_definition.rb +67 -0
- data/lib/rubocop/cop/rspec/verbose_include_metadata.rb +1 -1
- data/rubocop-default.yml +1 -3
- data/rubocop-gemspec.yml +17 -0
- data/rubocop-internal-affairs.yml +11 -0
- data/rubocop-lint.yml +4 -3
- data/rubocop-rails.yml +13 -1
- data/rubocop-rspec.yml +18 -1
- data/rubocop-style.yml +14 -6
- metadata +113 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aeba900b1e2b7dc4f6a82fa6defd2daaf2b4c6c87101e1d4fd8b2099e1c00aff
|
|
4
|
+
data.tar.gz: 02c28507a2a0ed18e555b9d2e44fde520e41de6cccd0e7b77a36b9452b651531
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ba653a6135f6cd2cb62268e6ee7df569827c3e6958763acb0d8b1d263192fbcf5634168266c60c13df05cd8635e9ca65560965a19ad2fb2a1816a6982cfefb6
|
|
7
|
+
data.tar.gz: 5da95736858e333062c060a33069a248e4b15824fd0d6c759a2c223e3c772a164534c9c2741760dd17d65eee67f98e1b0909d2f4199d96081e16de91967b8f69
|
data/.gitignore
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
<!-- Replace `<PREVIOUS_VERSION>` with the previous version number
|
|
1
|
+
<!-- Replace `<PREVIOUS_VERSION>` with the previous version number, `<COMMIT_UPDATING_VERSION>` with the latest
|
|
2
2
|
commit from this merge request, and `<NEW_VERSION>` with the upcoming version number. -->
|
|
3
3
|
## Diff
|
|
4
4
|
|
|
5
|
-
https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles
|
|
5
|
+
https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/compare/v<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
|
|
6
6
|
|
|
7
7
|
## Checklist
|
|
8
8
|
|
|
9
|
-
- [ ]
|
|
10
|
-
- [ ]
|
|
11
|
-
- [ ]
|
|
9
|
+
- [ ] Change the `VERSION` constant to a minor version in `lib/gitlab/styles/version.rb` (you might have to change the version number in the next steps according to [SemVer](https://semver.org)).
|
|
10
|
+
- [ ] Ensure the diff link above is up-to-date.
|
|
11
|
+
- [ ] Add release notes to the [Changelog](#changelog) section below.
|
|
12
|
+
- [ ] Based on the diff and the release notes, update the `version.rb` according to [SemVer](https://semver.org).
|
|
13
|
+
- [ ] Create an MR on `gitlab-org/gitlab` project [with the `New Version of gitlab-styles.md` template](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/merge_request_templates/New%20Version%20of%20gitlab-styles.md) to test the new version of `gitlab-styles`, and follow the MR instructions.
|
|
14
|
+
|
|
15
|
+
## Changelog
|
|
16
|
+
|
|
17
|
+
<!--
|
|
18
|
+
Paste output of:
|
|
19
|
+
|
|
20
|
+
curl https://gitlab.com/api/v4/projects/4176070/repository/changelog?version=<NEW_VERSION> | jq -r ".notes"
|
|
21
|
+
|
|
22
|
+
NOTE: Skip `v` in `<NEW_VERSION>`. For example, Use `version=10.0.0` instead of `version=v10.0.0`.
|
|
23
|
+
|
|
24
|
+
-->
|
|
12
25
|
|
|
13
26
|
/label ~"type::maintenance" ~"static code analysis"
|
data/.gitlab-ci.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
inherit_from:
|
|
2
|
-
- .rubocop_todo.yml
|
|
3
2
|
- rubocop-default.yml
|
|
3
|
+
- .rubocop_todo.yml
|
|
4
4
|
|
|
5
5
|
require:
|
|
6
6
|
- rubocop/cop/internal_affairs
|
|
@@ -9,6 +9,10 @@ require:
|
|
|
9
9
|
AllCops:
|
|
10
10
|
NewCops: disable # https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/40
|
|
11
11
|
|
|
12
|
+
Gemspec/DevelopmentDependencies:
|
|
13
|
+
EnforcedStyle: gemspec
|
|
14
|
+
Enabled: true
|
|
15
|
+
|
|
12
16
|
InternalAffairs/DeprecateCopHelper:
|
|
13
17
|
Enabled: true
|
|
14
18
|
Include:
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2023-
|
|
3
|
+
# on 2023-06-05 10:15:47 UTC using RuboCop version 1.50.2.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -10,3 +10,27 @@
|
|
|
10
10
|
InternalAffairs/InheritDeprecatedCopClass:
|
|
11
11
|
Exclude:
|
|
12
12
|
- 'lib/rubocop/cop/gitlab_security/json_serialization.rb'
|
|
13
|
+
|
|
14
|
+
# Offense count: 11
|
|
15
|
+
InternalAffairs/MissingCopDepartment:
|
|
16
|
+
Exclude:
|
|
17
|
+
- 'lib/rubocop/cop/active_record_dependent.rb'
|
|
18
|
+
- 'lib/rubocop/cop/active_record_serialize.rb'
|
|
19
|
+
- 'lib/rubocop/cop/avoid_return_from_blocks.rb'
|
|
20
|
+
- 'lib/rubocop/cop/custom_error_class.rb'
|
|
21
|
+
- 'lib/rubocop/cop/gem_fetcher.rb'
|
|
22
|
+
- 'lib/rubocop/cop/in_batches.rb'
|
|
23
|
+
- 'lib/rubocop/cop/line_break_after_guard_clauses.rb'
|
|
24
|
+
- 'lib/rubocop/cop/line_break_around_conditional_block.rb'
|
|
25
|
+
- 'lib/rubocop/cop/polymorphic_associations.rb'
|
|
26
|
+
- 'lib/rubocop/cop/redirect_with_status.rb'
|
|
27
|
+
- 'lib/rubocop/cop/without_reactive_cache.rb'
|
|
28
|
+
|
|
29
|
+
# Offense count: 5
|
|
30
|
+
InternalAffairs/UseRestrictOnSend:
|
|
31
|
+
Exclude:
|
|
32
|
+
- 'lib/rubocop/cop/active_record_dependent.rb'
|
|
33
|
+
- 'lib/rubocop/cop/active_record_serialize.rb'
|
|
34
|
+
- 'lib/rubocop/cop/in_batches.rb'
|
|
35
|
+
- 'lib/rubocop/cop/polymorphic_associations.rb'
|
|
36
|
+
- 'lib/rubocop/cop/without_reactive_cache.rb'
|
data/Gemfile
CHANGED
|
@@ -4,19 +4,3 @@ source 'https://rubygems.org'
|
|
|
4
4
|
|
|
5
5
|
# Specify your gem's dependencies in gitlab-rubocop.gemspec
|
|
6
6
|
gemspec
|
|
7
|
-
|
|
8
|
-
group :development do
|
|
9
|
-
gem 'lefthook', require: false
|
|
10
|
-
gem 'test_file_finder', '~> 0.1.4'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
group :test do
|
|
14
|
-
# Pin these dependencies, otherwise a new rule could break the CI pipelines
|
|
15
|
-
gem 'rubocop', '1.43.0'
|
|
16
|
-
gem 'rubocop-rspec', '2.18.1'
|
|
17
|
-
gem 'rspec-parameterized-table_syntax', '1.0.0', require: false
|
|
18
|
-
|
|
19
|
-
gem 'simplecov', '~> 0.22.0', require: false
|
|
20
|
-
gem 'simplecov-html', '~> 0.12.3', require: false
|
|
21
|
-
gem 'simplecov-cobertura', '~> 2.1.0', require: false
|
|
22
|
-
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
gitlab-styles (11.0.0)
|
|
5
|
+
rubocop (~> 1.57.1)
|
|
6
|
+
rubocop-graphql (~> 0.18)
|
|
7
|
+
rubocop-performance (~> 1.15)
|
|
8
|
+
rubocop-rails (~> 2.17)
|
|
9
|
+
rubocop-rspec (~> 2.22)
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: https://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
activesupport (7.0.4.3)
|
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
16
|
+
i18n (>= 1.6, < 2)
|
|
17
|
+
minitest (>= 5.1)
|
|
18
|
+
tzinfo (~> 2.0)
|
|
19
|
+
addressable (2.8.5)
|
|
20
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
21
|
+
ast (2.4.2)
|
|
22
|
+
base64 (0.1.1)
|
|
23
|
+
binding_of_caller (1.0.0)
|
|
24
|
+
debug_inspector (>= 0.0.1)
|
|
25
|
+
byebug (11.1.3)
|
|
26
|
+
claide (1.1.0)
|
|
27
|
+
claide-plugins (0.9.2)
|
|
28
|
+
cork
|
|
29
|
+
nap
|
|
30
|
+
open4 (~> 1.3)
|
|
31
|
+
coderay (1.1.3)
|
|
32
|
+
colored2 (3.1.2)
|
|
33
|
+
concurrent-ruby (1.2.2)
|
|
34
|
+
cork (0.3.0)
|
|
35
|
+
colored2 (~> 3.1)
|
|
36
|
+
danger (9.3.2)
|
|
37
|
+
claide (~> 1.0)
|
|
38
|
+
claide-plugins (>= 0.9.2)
|
|
39
|
+
colored2 (~> 3.1)
|
|
40
|
+
cork (~> 0.1)
|
|
41
|
+
faraday (>= 0.9.0, < 3.0)
|
|
42
|
+
faraday-http-cache (~> 2.0)
|
|
43
|
+
git (~> 1.13)
|
|
44
|
+
kramdown (~> 2.3)
|
|
45
|
+
kramdown-parser-gfm (~> 1.0)
|
|
46
|
+
no_proxy_fix
|
|
47
|
+
octokit (~> 6.0)
|
|
48
|
+
terminal-table (>= 1, < 4)
|
|
49
|
+
danger-gitlab (8.0.0)
|
|
50
|
+
danger
|
|
51
|
+
gitlab (~> 4.2, >= 4.2.0)
|
|
52
|
+
debug_inspector (1.1.0)
|
|
53
|
+
diff-lcs (1.5.0)
|
|
54
|
+
docile (1.4.0)
|
|
55
|
+
faraday (1.10.3)
|
|
56
|
+
faraday-em_http (~> 1.0)
|
|
57
|
+
faraday-em_synchrony (~> 1.0)
|
|
58
|
+
faraday-excon (~> 1.1)
|
|
59
|
+
faraday-httpclient (~> 1.0)
|
|
60
|
+
faraday-multipart (~> 1.0)
|
|
61
|
+
faraday-net_http (~> 1.0)
|
|
62
|
+
faraday-net_http_persistent (~> 1.0)
|
|
63
|
+
faraday-patron (~> 1.0)
|
|
64
|
+
faraday-rack (~> 1.0)
|
|
65
|
+
faraday-retry (~> 1.0)
|
|
66
|
+
ruby2_keywords (>= 0.0.4)
|
|
67
|
+
faraday-em_http (1.0.0)
|
|
68
|
+
faraday-em_synchrony (1.0.0)
|
|
69
|
+
faraday-excon (1.1.0)
|
|
70
|
+
faraday-http-cache (2.5.0)
|
|
71
|
+
faraday (>= 0.8)
|
|
72
|
+
faraday-httpclient (1.0.1)
|
|
73
|
+
faraday-multipart (1.0.4)
|
|
74
|
+
multipart-post (~> 2)
|
|
75
|
+
faraday-net_http (1.0.1)
|
|
76
|
+
faraday-net_http_persistent (1.2.0)
|
|
77
|
+
faraday-patron (1.0.0)
|
|
78
|
+
faraday-rack (1.0.0)
|
|
79
|
+
faraday-retry (1.0.3)
|
|
80
|
+
git (1.18.0)
|
|
81
|
+
addressable (~> 2.8)
|
|
82
|
+
rchardet (~> 1.8)
|
|
83
|
+
gitlab (4.19.0)
|
|
84
|
+
httparty (~> 0.20)
|
|
85
|
+
terminal-table (>= 1.5.1)
|
|
86
|
+
gitlab-dangerfiles (4.6.0)
|
|
87
|
+
danger (>= 9.3.0)
|
|
88
|
+
danger-gitlab (>= 8.0.0)
|
|
89
|
+
rake (~> 13.0)
|
|
90
|
+
httparty (0.21.0)
|
|
91
|
+
mini_mime (>= 1.0.0)
|
|
92
|
+
multi_xml (>= 0.5.2)
|
|
93
|
+
i18n (1.13.0)
|
|
94
|
+
concurrent-ruby (~> 1.0)
|
|
95
|
+
json (2.6.3)
|
|
96
|
+
kramdown (2.4.0)
|
|
97
|
+
rexml
|
|
98
|
+
kramdown-parser-gfm (1.1.0)
|
|
99
|
+
kramdown (~> 2.0)
|
|
100
|
+
language_server-protocol (3.17.0.3)
|
|
101
|
+
lefthook (1.3.13)
|
|
102
|
+
method_source (1.0.0)
|
|
103
|
+
mini_mime (1.1.5)
|
|
104
|
+
minitest (5.18.0)
|
|
105
|
+
multi_xml (0.6.0)
|
|
106
|
+
multipart-post (2.3.0)
|
|
107
|
+
nap (1.1.0)
|
|
108
|
+
no_proxy_fix (0.1.2)
|
|
109
|
+
octokit (6.1.1)
|
|
110
|
+
faraday (>= 1, < 3)
|
|
111
|
+
sawyer (~> 0.9)
|
|
112
|
+
open4 (1.3.4)
|
|
113
|
+
parallel (1.23.0)
|
|
114
|
+
parser (3.2.2.4)
|
|
115
|
+
ast (~> 2.4.1)
|
|
116
|
+
racc
|
|
117
|
+
proc_to_ast (0.1.0)
|
|
118
|
+
coderay
|
|
119
|
+
parser
|
|
120
|
+
unparser
|
|
121
|
+
pry (0.14.2)
|
|
122
|
+
coderay (~> 1.1)
|
|
123
|
+
method_source (~> 1.0)
|
|
124
|
+
pry-byebug (3.10.1)
|
|
125
|
+
byebug (~> 11.0)
|
|
126
|
+
pry (>= 0.13, < 0.15)
|
|
127
|
+
public_suffix (5.0.3)
|
|
128
|
+
racc (1.7.1)
|
|
129
|
+
rack (3.0.7)
|
|
130
|
+
rainbow (3.1.1)
|
|
131
|
+
rake (13.0.6)
|
|
132
|
+
rchardet (1.8.0)
|
|
133
|
+
regexp_parser (2.8.1)
|
|
134
|
+
rexml (3.2.6)
|
|
135
|
+
rspec (3.12.0)
|
|
136
|
+
rspec-core (~> 3.12.0)
|
|
137
|
+
rspec-expectations (~> 3.12.0)
|
|
138
|
+
rspec-mocks (~> 3.12.0)
|
|
139
|
+
rspec-core (3.12.2)
|
|
140
|
+
rspec-support (~> 3.12.0)
|
|
141
|
+
rspec-expectations (3.12.3)
|
|
142
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
143
|
+
rspec-support (~> 3.12.0)
|
|
144
|
+
rspec-mocks (3.12.5)
|
|
145
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
146
|
+
rspec-support (~> 3.12.0)
|
|
147
|
+
rspec-parameterized-core (1.0.0)
|
|
148
|
+
parser
|
|
149
|
+
proc_to_ast
|
|
150
|
+
rspec (>= 2.13, < 4)
|
|
151
|
+
unparser
|
|
152
|
+
rspec-parameterized-table_syntax (1.0.0)
|
|
153
|
+
binding_of_caller
|
|
154
|
+
rspec-parameterized-core (< 2)
|
|
155
|
+
rspec-support (3.12.0)
|
|
156
|
+
rubocop (1.57.1)
|
|
157
|
+
base64 (~> 0.1.1)
|
|
158
|
+
json (~> 2.3)
|
|
159
|
+
language_server-protocol (>= 3.17.0)
|
|
160
|
+
parallel (~> 1.10)
|
|
161
|
+
parser (>= 3.2.2.4)
|
|
162
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
163
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
164
|
+
rexml (>= 3.2.5, < 4.0)
|
|
165
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
|
166
|
+
ruby-progressbar (~> 1.7)
|
|
167
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
168
|
+
rubocop-ast (1.29.0)
|
|
169
|
+
parser (>= 3.2.1.0)
|
|
170
|
+
rubocop-capybara (2.19.0)
|
|
171
|
+
rubocop (~> 1.41)
|
|
172
|
+
rubocop-factory_bot (2.24.0)
|
|
173
|
+
rubocop (~> 1.33)
|
|
174
|
+
rubocop-graphql (0.19.0)
|
|
175
|
+
rubocop (>= 0.87, < 2)
|
|
176
|
+
rubocop-performance (1.19.1)
|
|
177
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
178
|
+
rubocop-ast (>= 0.4.0)
|
|
179
|
+
rubocop-rails (2.19.1)
|
|
180
|
+
activesupport (>= 4.2.0)
|
|
181
|
+
rack (>= 1.1)
|
|
182
|
+
rubocop (>= 1.33.0, < 2.0)
|
|
183
|
+
rubocop-rake (0.6.0)
|
|
184
|
+
rubocop (~> 1.0)
|
|
185
|
+
rubocop-rspec (2.24.1)
|
|
186
|
+
rubocop (~> 1.33)
|
|
187
|
+
rubocop-capybara (~> 2.17)
|
|
188
|
+
rubocop-factory_bot (~> 2.22)
|
|
189
|
+
ruby-progressbar (1.13.0)
|
|
190
|
+
ruby2_keywords (0.0.5)
|
|
191
|
+
sawyer (0.9.2)
|
|
192
|
+
addressable (>= 2.3.5)
|
|
193
|
+
faraday (>= 0.17.3, < 3)
|
|
194
|
+
simplecov (0.22.0)
|
|
195
|
+
docile (~> 1.1)
|
|
196
|
+
simplecov-html (~> 0.11)
|
|
197
|
+
simplecov_json_formatter (~> 0.1)
|
|
198
|
+
simplecov-cobertura (2.1.0)
|
|
199
|
+
rexml
|
|
200
|
+
simplecov (~> 0.19)
|
|
201
|
+
simplecov-html (0.12.3)
|
|
202
|
+
simplecov_json_formatter (0.1.4)
|
|
203
|
+
terminal-table (3.0.2)
|
|
204
|
+
unicode-display_width (>= 1.1.1, < 3)
|
|
205
|
+
test_file_finder (0.1.4)
|
|
206
|
+
faraday (~> 1.0)
|
|
207
|
+
tzinfo (2.0.6)
|
|
208
|
+
concurrent-ruby (~> 1.0)
|
|
209
|
+
unicode-display_width (2.5.0)
|
|
210
|
+
unparser (0.6.7)
|
|
211
|
+
diff-lcs (~> 1.3)
|
|
212
|
+
parser (>= 3.2.0)
|
|
213
|
+
|
|
214
|
+
PLATFORMS
|
|
215
|
+
ruby
|
|
216
|
+
|
|
217
|
+
DEPENDENCIES
|
|
218
|
+
bundler (~> 2.1)
|
|
219
|
+
gitlab-dangerfiles (~> 4.6.0)
|
|
220
|
+
gitlab-styles!
|
|
221
|
+
lefthook (~> 1.3.13)
|
|
222
|
+
pry-byebug (~> 3.10)
|
|
223
|
+
rake (~> 13.0)
|
|
224
|
+
rspec (~> 3.0)
|
|
225
|
+
rspec-parameterized-table_syntax (~> 1.0.0)
|
|
226
|
+
rubocop-rake (~> 0.6)
|
|
227
|
+
simplecov (~> 0.22.0)
|
|
228
|
+
simplecov-cobertura (~> 2.1.0)
|
|
229
|
+
simplecov-html (~> 0.12.3)
|
|
230
|
+
test_file_finder (~> 0.1.4)
|
|
231
|
+
|
|
232
|
+
BUNDLED WITH
|
|
233
|
+
2.4.13
|
data/README.md
CHANGED
|
@@ -91,8 +91,8 @@ To release a new version:
|
|
|
91
91
|
1. Create a Merge Request.
|
|
92
92
|
1. Use Merge Request template [Release.md](https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/blob/master/.gitlab/merge_request_templates/Release.md).
|
|
93
93
|
1. Follow the instructions.
|
|
94
|
-
1.
|
|
95
|
-
1.
|
|
94
|
+
1. After the Merge Request has been merged, a new gem version is [published automatically](https://gitlab.com/gitlab-org/quality/pipeline-common/-/blob/master/ci/gem-release.yml).
|
|
95
|
+
1. Once the new gem version is visible on [RubyGems.org](https://rubygems.org/gems/gitlab-styles), it is recommended to update [GitLab's `Gemfile`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/Gemfile) to bump the `gitlab-styles` Ruby gem to the new version also.
|
|
96
96
|
|
|
97
97
|
See [!123](https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/123) as an example.
|
|
98
98
|
|
data/gitlab-styles.gemspec
CHANGED
|
@@ -22,15 +22,22 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
23
|
spec.require_paths = ['lib']
|
|
24
24
|
|
|
25
|
-
spec.add_dependency 'rubocop', '~> 1.
|
|
25
|
+
spec.add_dependency 'rubocop', '~> 1.57.1'
|
|
26
26
|
spec.add_dependency 'rubocop-graphql', '~> 0.18'
|
|
27
27
|
spec.add_dependency 'rubocop-performance', '~> 1.15'
|
|
28
28
|
spec.add_dependency 'rubocop-rails', '~> 2.17'
|
|
29
|
-
spec.add_dependency 'rubocop-rspec', '~> 2.
|
|
29
|
+
spec.add_dependency 'rubocop-rspec', '~> 2.22'
|
|
30
30
|
|
|
31
31
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
|
32
|
-
spec.add_development_dependency 'gitlab-dangerfiles', '~>
|
|
32
|
+
spec.add_development_dependency 'gitlab-dangerfiles', '~> 4.6.0'
|
|
33
|
+
spec.add_development_dependency 'lefthook', '~> 1.3.13'
|
|
34
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.10'
|
|
33
35
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
34
36
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
37
|
+
spec.add_development_dependency 'rspec-parameterized-table_syntax', '~> 1.0.0'
|
|
35
38
|
spec.add_development_dependency 'rubocop-rake', '~> 0.6'
|
|
39
|
+
spec.add_development_dependency 'simplecov', '~> 0.22.0'
|
|
40
|
+
spec.add_development_dependency 'simplecov-cobertura', '~> 2.1.0'
|
|
41
|
+
spec.add_development_dependency 'simplecov-html', '~> 0.12.3'
|
|
42
|
+
spec.add_development_dependency 'test_file_finder', '~> 0.1.4'
|
|
36
43
|
end
|
|
@@ -7,7 +7,7 @@ module Gitlab
|
|
|
7
7
|
module MigrationHelpers
|
|
8
8
|
# Returns true if the given node originated from the db/migrate directory.
|
|
9
9
|
def in_migration?(node)
|
|
10
|
-
dirname = File.dirname(node.
|
|
10
|
+
dirname = File.dirname(node.source_range.source_buffer.name)
|
|
11
11
|
|
|
12
12
|
dirname.end_with?(
|
|
13
13
|
'db/migrate',
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
module InternalAffairs
|
|
6
|
+
# Enforces the use of explicit department names for cop rules.
|
|
7
|
+
#
|
|
8
|
+
# @example
|
|
9
|
+
# # bad
|
|
10
|
+
# module RuboCop
|
|
11
|
+
# module Cop
|
|
12
|
+
# class Implicit
|
|
13
|
+
# end
|
|
14
|
+
# end
|
|
15
|
+
# end
|
|
16
|
+
#
|
|
17
|
+
# module RuboCop
|
|
18
|
+
# module Cop
|
|
19
|
+
# module Cop
|
|
20
|
+
# class Explicit
|
|
21
|
+
# end
|
|
22
|
+
# end
|
|
23
|
+
# end
|
|
24
|
+
# end
|
|
25
|
+
#
|
|
26
|
+
# # good
|
|
27
|
+
# module RuboCop
|
|
28
|
+
# module Cop
|
|
29
|
+
# module Foo
|
|
30
|
+
# class Implicit
|
|
31
|
+
# end
|
|
32
|
+
# end
|
|
33
|
+
# end
|
|
34
|
+
# end
|
|
35
|
+
#
|
|
36
|
+
# module RuboCop
|
|
37
|
+
# module Cop
|
|
38
|
+
# module Foo
|
|
39
|
+
# class Explicit
|
|
40
|
+
# end
|
|
41
|
+
# end
|
|
42
|
+
# end
|
|
43
|
+
# end
|
|
44
|
+
class MissingCopDepartment < Base
|
|
45
|
+
MSG = 'Define a proper department. Using `Cop/` as department is discourged.'
|
|
46
|
+
|
|
47
|
+
COP_DEPARTMENT = 'Cop'
|
|
48
|
+
|
|
49
|
+
def on_class(node)
|
|
50
|
+
namespace = full_namespace(node)
|
|
51
|
+
|
|
52
|
+
# Skip top-level RuboCop::Cop
|
|
53
|
+
names = namespace.drop(2)
|
|
54
|
+
|
|
55
|
+
add_offense(node.loc.name) if names.size < 2 || names.first == COP_DEPARTMENT
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
def full_namespace(node)
|
|
61
|
+
(node_namespace(node) + parents_namespace(node)).reverse
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def node_namespace(node)
|
|
65
|
+
name_parts(node).reverse
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def parents_namespace(node)
|
|
69
|
+
node
|
|
70
|
+
.each_ancestor(:module, :class)
|
|
71
|
+
.flat_map { |node| name_parts(node) }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def name_parts(node)
|
|
75
|
+
node.identifier.source.split('::')
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
module InternalAffairs
|
|
6
|
+
# Flags if `RESTRICT_ON_SEND` constant not defined and method name is
|
|
7
|
+
# checked programmatically in `on_send` methods.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# # bad
|
|
11
|
+
# def on_send(node)
|
|
12
|
+
# return unless method_name(node) == :foo
|
|
13
|
+
# return unless node.children[1] == :foo
|
|
14
|
+
# return unless METHOD_NAMES.include?(method_name(node))
|
|
15
|
+
#
|
|
16
|
+
# name = node.children[1]
|
|
17
|
+
# return unless name == :foo
|
|
18
|
+
# name2 = method_name(node)
|
|
19
|
+
# return unless name == :foo
|
|
20
|
+
#
|
|
21
|
+
# # more code
|
|
22
|
+
# end
|
|
23
|
+
#
|
|
24
|
+
# # good
|
|
25
|
+
# RESTRICT_ON_SEND = %i[foo].freeze
|
|
26
|
+
#
|
|
27
|
+
# def on_send(node)
|
|
28
|
+
# # more code
|
|
29
|
+
# end
|
|
30
|
+
#
|
|
31
|
+
# # ignored - not `on_send`
|
|
32
|
+
# def on_def(node)
|
|
33
|
+
# return unless method_name(node) == :foo
|
|
34
|
+
# end
|
|
35
|
+
#
|
|
36
|
+
# # ignored - `else` branch
|
|
37
|
+
# def on_send(node)
|
|
38
|
+
# if method_name(node) == :foo
|
|
39
|
+
# add_offense(node)
|
|
40
|
+
# else
|
|
41
|
+
# something_else
|
|
42
|
+
# end
|
|
43
|
+
# end
|
|
44
|
+
class UseRestrictOnSend < Base
|
|
45
|
+
MSG = 'Define constant `RESTRICT_ON_SEND` to speed up calls to `on_send`. ' \
|
|
46
|
+
'The following line is then no longer necessary:'
|
|
47
|
+
|
|
48
|
+
# @!method method_name_plain(node)
|
|
49
|
+
def_node_matcher :method_name_plain, <<~PATTERN
|
|
50
|
+
{
|
|
51
|
+
(send _ :method_name _ ...) # method_name(node)
|
|
52
|
+
(send
|
|
53
|
+
(send _ :children) :[] (int 1) # node.children[1]
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
PATTERN
|
|
57
|
+
|
|
58
|
+
# @!method method_name_call(node)
|
|
59
|
+
def_node_matcher :method_name_call, <<~PATTERN
|
|
60
|
+
{
|
|
61
|
+
#method_name_plain
|
|
62
|
+
(lvar %1)
|
|
63
|
+
}
|
|
64
|
+
PATTERN
|
|
65
|
+
|
|
66
|
+
# @!method method_name_assignment(node)
|
|
67
|
+
def_node_search :method_name_assignment, <<~PATTERN
|
|
68
|
+
(lvasgn $_name #method_name_plain)
|
|
69
|
+
PATTERN
|
|
70
|
+
|
|
71
|
+
# @!method method_name_check(node)
|
|
72
|
+
def_node_search :method_name_check, <<~PATTERN
|
|
73
|
+
(if
|
|
74
|
+
${
|
|
75
|
+
(send #method_name_call(%1) {:== :!=} _) # method_name(node) == foo
|
|
76
|
+
(send _ :include? #method_name_call(%1)) # a.include?(method_name(node))
|
|
77
|
+
}
|
|
78
|
+
{!nil? nil? | nil? !nil?} # has either `if` or `else` branch - not both
|
|
79
|
+
)
|
|
80
|
+
PATTERN
|
|
81
|
+
|
|
82
|
+
def on_def(node)
|
|
83
|
+
return unless node.method?(:on_send)
|
|
84
|
+
return if @restrict_on_send_set
|
|
85
|
+
|
|
86
|
+
local_assignments = method_name_assignment(node).to_set
|
|
87
|
+
|
|
88
|
+
method_name_check(node, local_assignments) do |call_node|
|
|
89
|
+
add_offense(call_node)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def on_casgn(node)
|
|
94
|
+
@restrict_on_send_set = true if node.name == :RESTRICT_ON_SEND
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -71,7 +71,7 @@ module Rubocop
|
|
|
71
71
|
return if next_line(node).blank? || clause_last_line?(next_line(node)) || guard_clause?(next_sibling(node))
|
|
72
72
|
|
|
73
73
|
add_offense(node) do |corrector|
|
|
74
|
-
corrector.insert_after(node
|
|
74
|
+
corrector.insert_after(node, "\n")
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
|
|
@@ -44,8 +44,15 @@ module Rubocop
|
|
|
44
44
|
MSG = 'Add an empty line after `%<example>s` block.'
|
|
45
45
|
|
|
46
46
|
# @!method shared_examples(node)
|
|
47
|
-
def_node_matcher :shared_examples,
|
|
48
|
-
|
|
47
|
+
def_node_matcher :shared_examples, <<~PATTERN
|
|
48
|
+
{
|
|
49
|
+
(block (send #rspec? #SharedGroups.all ...) ...)
|
|
50
|
+
{
|
|
51
|
+
(block (send nil? #Includes.all ...) ...)
|
|
52
|
+
(send nil? #Includes.all ...)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
PATTERN
|
|
49
56
|
|
|
50
57
|
def on_block(node)
|
|
51
58
|
shared_examples(node) do
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rubocop-rspec'
|
|
4
|
+
require_relative '../base'
|
|
5
|
+
|
|
6
|
+
module Rubocop
|
|
7
|
+
module Cop
|
|
8
|
+
module RSpec
|
|
9
|
+
module FactoryBot
|
|
10
|
+
# Check for create_list FactoryBot declarations higher than configured MaxAmount.
|
|
11
|
+
#
|
|
12
|
+
# @example MaxAmount: 20
|
|
13
|
+
# We do not allow more than 20 items to be created.
|
|
14
|
+
#
|
|
15
|
+
# # bad
|
|
16
|
+
# create_list(:merge_request, 1000, state: :opened)
|
|
17
|
+
#
|
|
18
|
+
# # good
|
|
19
|
+
# create_list(:merge_request, 15, state: :opened)
|
|
20
|
+
#
|
|
21
|
+
# @example
|
|
22
|
+
# We do not allow more than 10 items to be created (default)
|
|
23
|
+
# # bad
|
|
24
|
+
# create_list(:merge_request, 1000, state: :opened)
|
|
25
|
+
#
|
|
26
|
+
# # good
|
|
27
|
+
# create_list(:merge_request, 10, state: :opened)
|
|
28
|
+
#
|
|
29
|
+
class ExcessiveCreateList < Base
|
|
30
|
+
MESSAGE = 'Avoid using `create_list` with more than %{max_amount} items.'
|
|
31
|
+
|
|
32
|
+
# @!method create_list?(node)
|
|
33
|
+
def_node_matcher :create_list?, <<~PATTERN
|
|
34
|
+
(send nil? :create_list (sym ...) $(int _) ...)
|
|
35
|
+
PATTERN
|
|
36
|
+
|
|
37
|
+
RESTRICT_ON_SEND = %i[create_list].freeze
|
|
38
|
+
|
|
39
|
+
def on_send(node)
|
|
40
|
+
number_node = create_list?(node)
|
|
41
|
+
return unless number_node
|
|
42
|
+
|
|
43
|
+
max_amount = cop_config['MaxAmount']
|
|
44
|
+
return if number_node.value <= max_amount
|
|
45
|
+
|
|
46
|
+
add_offense(number_node, message: format(MESSAGE, max_amount: max_amount))
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rubocop-rspec'
|
|
4
|
+
require_relative 'base'
|
|
5
|
+
|
|
6
|
+
module Rubocop
|
|
7
|
+
module Cop
|
|
8
|
+
module RSpec
|
|
9
|
+
# Checks whether `specify` is used with `is_expected` and suggests the
|
|
10
|
+
# use of `it`.
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
#
|
|
14
|
+
# # bad
|
|
15
|
+
# specify { is_expected.to eq(true) }
|
|
16
|
+
#
|
|
17
|
+
# # good
|
|
18
|
+
# it { is_expected.to eq(true) }
|
|
19
|
+
#
|
|
20
|
+
class SpecifyExpected < Base
|
|
21
|
+
extend RuboCop::Cop::AutoCorrector
|
|
22
|
+
|
|
23
|
+
MSG = 'Prefer using `it` when used with `is_expected`.'
|
|
24
|
+
|
|
25
|
+
# @!method specify_with_expected?(node)
|
|
26
|
+
def_node_matcher :specify_with_expected?, <<~PATTERN
|
|
27
|
+
(block
|
|
28
|
+
(send nil? :specify ...)
|
|
29
|
+
_args
|
|
30
|
+
(send
|
|
31
|
+
(send nil? :is_expected)
|
|
32
|
+
...
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
PATTERN
|
|
36
|
+
|
|
37
|
+
RESTRICT_ON_SEND = %i[specify].freeze
|
|
38
|
+
|
|
39
|
+
def on_send(node)
|
|
40
|
+
return unless specify_with_expected?(node.parent)
|
|
41
|
+
|
|
42
|
+
add_offense(node) do |corrector|
|
|
43
|
+
corrector.replace(node, 'it')
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
|
|
5
|
+
module Rubocop
|
|
6
|
+
module Cop
|
|
7
|
+
module RSpec
|
|
8
|
+
# Flags useless dynamic hook/let definitions via `.each`, `.each_key`, or
|
|
9
|
+
# `.each_value` without defining a wrapping `context` explicitly inside
|
|
10
|
+
# the loop block. Without it, the let definition will always/only be set
|
|
11
|
+
# to the final value.
|
|
12
|
+
#
|
|
13
|
+
# @example
|
|
14
|
+
#
|
|
15
|
+
# # bad
|
|
16
|
+
# context 'foo' do
|
|
17
|
+
# [true, false].each do |bool|
|
|
18
|
+
# before do
|
|
19
|
+
# stub_something(bool: bool)
|
|
20
|
+
# end
|
|
21
|
+
#
|
|
22
|
+
# let(:foo) { build(:model, bool: bool) }
|
|
23
|
+
#
|
|
24
|
+
# it 'works' do
|
|
25
|
+
# # `bool` is always `false`
|
|
26
|
+
# end
|
|
27
|
+
# end
|
|
28
|
+
# end
|
|
29
|
+
#
|
|
30
|
+
# # good
|
|
31
|
+
# context 'foo' do
|
|
32
|
+
# [true, false].each do |bool|
|
|
33
|
+
# context "with bool #{bool}" do # <--
|
|
34
|
+
# before do
|
|
35
|
+
# stub_something(bool: bool)
|
|
36
|
+
# end
|
|
37
|
+
#
|
|
38
|
+
# let(:foo) { build(:model, bool: bool) }
|
|
39
|
+
#
|
|
40
|
+
# it 'works' do
|
|
41
|
+
# # `bool` is `true` and then `false`
|
|
42
|
+
# end
|
|
43
|
+
# end
|
|
44
|
+
# end
|
|
45
|
+
# end
|
|
46
|
+
class UselessDynamicDefinition < Base
|
|
47
|
+
MSG = 'Avoid useless dynamic definitions without `context`.'
|
|
48
|
+
|
|
49
|
+
RESTRICT_ON_SEND = %i[each each_key each_value].freeze
|
|
50
|
+
|
|
51
|
+
def on_send(node)
|
|
52
|
+
return unless dynamic_definition?(node.parent)
|
|
53
|
+
|
|
54
|
+
add_offense(node.loc.selector)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def dynamic_definition?(node)
|
|
60
|
+
group = RuboCop::RSpec::ExampleGroup.new(node)
|
|
61
|
+
|
|
62
|
+
group.lets.any? || group.hooks.any?
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -42,7 +42,7 @@ module Rubocop
|
|
|
42
42
|
invalid_metadata_matches(node) do |match|
|
|
43
43
|
add_offense(node, message: format(MSG, good(match), bad(match))) do |corrector|
|
|
44
44
|
invalid_metadata_matches(node) do |match|
|
|
45
|
-
corrector.replace(match
|
|
45
|
+
corrector.replace(match, good(match))
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
end
|
data/rubocop-default.yml
CHANGED
|
@@ -13,6 +13,7 @@ inherit_from:
|
|
|
13
13
|
- rubocop-fips.yml
|
|
14
14
|
- rubocop-gemspec.yml
|
|
15
15
|
- rubocop-graphql.yml
|
|
16
|
+
- rubocop-internal-affairs.yml
|
|
16
17
|
- rubocop-layout.yml
|
|
17
18
|
- rubocop-lint.yml
|
|
18
19
|
- rubocop-metrics.yml
|
|
@@ -23,6 +24,3 @@ inherit_from:
|
|
|
23
24
|
- rubocop-rspec.yml
|
|
24
25
|
- rubocop-security.yml
|
|
25
26
|
- rubocop-style.yml
|
|
26
|
-
|
|
27
|
-
InternalAffairs/DeprecateCopHelper:
|
|
28
|
-
Enabled: false
|
data/rubocop-gemspec.yml
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
---
|
|
2
|
+
# Checks that deprecated attributes are not set in a gemspec file. Removing
|
|
3
|
+
# deprecated attributes allows the user to receive smaller packed gems.
|
|
4
|
+
Gemspec/DeprecatedAttributeAssignment:
|
|
5
|
+
Enabled: true
|
|
6
|
+
|
|
7
|
+
# Enforce that development dependencies for a gem are specified in Gemfile,
|
|
8
|
+
# rather than in the gemspec using add_development_dependency
|
|
9
|
+
# Reason: Each project may decide to use a different strategy.
|
|
10
|
+
Gemspec/DevelopmentDependencies:
|
|
11
|
+
Enabled: false
|
|
12
|
+
|
|
2
13
|
# Dependencies in the gemspec should be alphabetically sorted
|
|
3
14
|
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
|
|
4
15
|
Gemspec/OrderedDependencies:
|
|
5
16
|
Include:
|
|
6
17
|
- '**/*.gemspec'
|
|
18
|
+
|
|
19
|
+
# Requires a gemspec to have rubygems_mfa_required metadata set.
|
|
20
|
+
# Most gems are released via CI and MFA cannot be used with improved security.
|
|
21
|
+
# See https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/merge_requests/313#note_1605402392
|
|
22
|
+
Gemspec/RequireMFA:
|
|
23
|
+
Enabled: false
|
data/rubocop-lint.yml
CHANGED
|
@@ -27,10 +27,11 @@ Lint/AmbiguousRange:
|
|
|
27
27
|
Lint/AmbiguousRegexpLiteral:
|
|
28
28
|
Enabled: true
|
|
29
29
|
|
|
30
|
-
# This cop checks for assignments in the conditions of
|
|
31
|
-
#
|
|
30
|
+
# This cop checks for assignments in the conditions of if/while/until.
|
|
31
|
+
# Forbid assignments within conditions.
|
|
32
32
|
Lint/AssignmentInCondition:
|
|
33
|
-
Enabled:
|
|
33
|
+
Enabled: true
|
|
34
|
+
AllowSafeAssignment: false
|
|
34
35
|
|
|
35
36
|
# Checks for places where binary operator has identical operands
|
|
36
37
|
Lint/BinaryOperatorWithIdenticalOperands:
|
data/rubocop-rails.yml
CHANGED
|
@@ -140,7 +140,7 @@ Rails/Output:
|
|
|
140
140
|
# This cop checks for the use of output safety calls like html_safe and
|
|
141
141
|
# raw.
|
|
142
142
|
Rails/OutputSafety:
|
|
143
|
-
Enabled:
|
|
143
|
+
Enabled: true
|
|
144
144
|
|
|
145
145
|
# Enforces the use of pluck over map.
|
|
146
146
|
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluck
|
|
@@ -178,6 +178,11 @@ Rails/RenderInline:
|
|
|
178
178
|
Rails/RenderPlainText:
|
|
179
179
|
Enabled: true
|
|
180
180
|
|
|
181
|
+
# Checks for the usage of obsolete `require_dependency` method for Rails
|
|
182
|
+
# applications running in Zeitwerk mode.
|
|
183
|
+
Rails/RequireDependency:
|
|
184
|
+
Enabled: true
|
|
185
|
+
|
|
181
186
|
# Checks the arguments of ActiveRecord scopes.
|
|
182
187
|
Rails/ScopeArgs:
|
|
183
188
|
Enabled: true
|
|
@@ -196,6 +201,13 @@ Rails/SquishedSQLHeredocs:
|
|
|
196
201
|
Rails/TimeZone:
|
|
197
202
|
Enabled: false
|
|
198
203
|
|
|
204
|
+
# Checks for the use of exit statements (namely return, break and throw) in
|
|
205
|
+
# transactions. This is due to the eventual unexpected behavior when using
|
|
206
|
+
# ActiveRecord >= 7, where transactions exited using these statements are being
|
|
207
|
+
# rollbacked rather than committed (pre ActiveRecord 7 behavior).
|
|
208
|
+
Rails/TransactionExitStatement:
|
|
209
|
+
Enabled: true
|
|
210
|
+
|
|
199
211
|
# This cop checks for the use of old-style attribute validation macros.
|
|
200
212
|
Rails/Validation:
|
|
201
213
|
Enabled: true
|
data/rubocop-rspec.yml
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
require:
|
|
3
3
|
- ./lib/gitlab/styles/rubocop
|
|
4
4
|
|
|
5
|
+
# Check for create_list FactoryBot declarations higher than MaxAmount
|
|
6
|
+
RSpec/FactoryBot/ExcessiveCreateList:
|
|
7
|
+
Enabled: true
|
|
8
|
+
MaxAmount: 10
|
|
9
|
+
|
|
5
10
|
# Check that instances are not being stubbed globally.
|
|
6
11
|
RSpec/AnyInstance:
|
|
7
12
|
Enabled: false
|
|
@@ -78,6 +83,7 @@ RSpec/ExpectOutput:
|
|
|
78
83
|
Enabled: true
|
|
79
84
|
|
|
80
85
|
# Checks the file and folder naming of the spec file.
|
|
86
|
+
# Will be replaced with RSpec/SpecFilePathFormat and RSpec/SpecFilePathSuffix.
|
|
81
87
|
RSpec/FilePath:
|
|
82
88
|
Enabled: true
|
|
83
89
|
IgnoreMethods: true
|
|
@@ -132,7 +138,7 @@ RSpec/MultipleExpectations:
|
|
|
132
138
|
|
|
133
139
|
# Checks for explicitly referenced test subjects.
|
|
134
140
|
RSpec/NamedSubject:
|
|
135
|
-
Enabled:
|
|
141
|
+
Enabled: true
|
|
136
142
|
|
|
137
143
|
# Checks for nested example groups.
|
|
138
144
|
RSpec/NestedGroups:
|
|
@@ -158,6 +164,17 @@ RSpec/SingleLineHook:
|
|
|
158
164
|
- 'spec/factories/*'
|
|
159
165
|
- 'spec/requests/api/v3/*'
|
|
160
166
|
|
|
167
|
+
# Checks the file and folder naming of the spec file.
|
|
168
|
+
# Will replace RSpec/FilePath.
|
|
169
|
+
RSpec/SpecFilePathFormat:
|
|
170
|
+
Enabled: false
|
|
171
|
+
IgnoreMethods: true
|
|
172
|
+
|
|
173
|
+
# Checks the file and folder naming of the spec file.
|
|
174
|
+
# Will replace RSpec/FilePath.
|
|
175
|
+
RSpec/SpecFilePathSuffix:
|
|
176
|
+
Enabled: false
|
|
177
|
+
|
|
161
178
|
# Checks that message expectations do not have a configured response.
|
|
162
179
|
# https://docs.rubocop.org/rubocop-rspec/1.44/cops_rspec.html#rspecstubbedmock
|
|
163
180
|
RSpec/StubbedMock:
|
data/rubocop-style.yml
CHANGED
|
@@ -52,10 +52,14 @@ Style/BisectedAttrAccessor:
|
|
|
52
52
|
Style/BlockComments:
|
|
53
53
|
Enabled: true
|
|
54
54
|
|
|
55
|
-
# Avoid using {...} for multi-line blocks (
|
|
56
|
-
#
|
|
55
|
+
# Avoid using {...} for multi-line blocks (multi-line chaining is always ugly).
|
|
56
|
+
# Prefer {...} over do...end for single-line blocks.
|
|
57
57
|
Style/BlockDelimiters:
|
|
58
58
|
Enabled: true
|
|
59
|
+
# Do flag `it {` in multi-line blocks. Off by default.
|
|
60
|
+
AllowedMethods:
|
|
61
|
+
- proc
|
|
62
|
+
- lambda
|
|
59
63
|
|
|
60
64
|
# Checks for uses of the case equality operator(===).
|
|
61
65
|
Style/CaseEquality:
|
|
@@ -127,11 +131,10 @@ Style/EndBlock:
|
|
|
127
131
|
Style/EvenOdd:
|
|
128
132
|
Enabled: true
|
|
129
133
|
|
|
130
|
-
#
|
|
131
|
-
#
|
|
132
|
-
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleexplicitblockargument
|
|
134
|
+
# Reason: Using `yield` is ~20% faster than `&block`.
|
|
135
|
+
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/94090#note_1452639709
|
|
133
136
|
Style/ExplicitBlockArgument:
|
|
134
|
-
Enabled:
|
|
137
|
+
Enabled: false
|
|
135
138
|
|
|
136
139
|
# Enforces consistency when using exponential notation for numbers in the code
|
|
137
140
|
Style/ExponentialNotation:
|
|
@@ -308,6 +311,11 @@ Style/NumberedParametersLimit:
|
|
|
308
311
|
Style/NumericLiterals:
|
|
309
312
|
Enabled: false
|
|
310
313
|
|
|
314
|
+
|
|
315
|
+
# Enforces the use Object#then instead of Object#yield_self.
|
|
316
|
+
Style/ObjectThen:
|
|
317
|
+
Enabled: true
|
|
318
|
+
|
|
311
319
|
# Favor the ternary operator(?:) over if/then/else/end constructs.
|
|
312
320
|
Style/OneLineConditional:
|
|
313
321
|
Enabled: true
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gitlab-styles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 11.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GitLab
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-11-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rubocop
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.
|
|
19
|
+
version: 1.57.1
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.
|
|
26
|
+
version: 1.57.1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rubocop-graphql
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '2.
|
|
75
|
+
version: '2.22'
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '2.
|
|
82
|
+
version: '2.22'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: bundler
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,14 +100,42 @@ dependencies:
|
|
|
100
100
|
requirements:
|
|
101
101
|
- - "~>"
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version:
|
|
103
|
+
version: 4.6.0
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
108
|
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
110
|
+
version: 4.6.0
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: lefthook
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 1.3.13
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 1.3.13
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: pry-byebug
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - "~>"
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '3.10'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - "~>"
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '3.10'
|
|
111
139
|
- !ruby/object:Gem::Dependency
|
|
112
140
|
name: rake
|
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -136,6 +164,20 @@ dependencies:
|
|
|
136
164
|
- - "~>"
|
|
137
165
|
- !ruby/object:Gem::Version
|
|
138
166
|
version: '3.0'
|
|
167
|
+
- !ruby/object:Gem::Dependency
|
|
168
|
+
name: rspec-parameterized-table_syntax
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - "~>"
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: 1.0.0
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - "~>"
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: 1.0.0
|
|
139
181
|
- !ruby/object:Gem::Dependency
|
|
140
182
|
name: rubocop-rake
|
|
141
183
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,6 +192,62 @@ dependencies:
|
|
|
150
192
|
- - "~>"
|
|
151
193
|
- !ruby/object:Gem::Version
|
|
152
194
|
version: '0.6'
|
|
195
|
+
- !ruby/object:Gem::Dependency
|
|
196
|
+
name: simplecov
|
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
|
198
|
+
requirements:
|
|
199
|
+
- - "~>"
|
|
200
|
+
- !ruby/object:Gem::Version
|
|
201
|
+
version: 0.22.0
|
|
202
|
+
type: :development
|
|
203
|
+
prerelease: false
|
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
205
|
+
requirements:
|
|
206
|
+
- - "~>"
|
|
207
|
+
- !ruby/object:Gem::Version
|
|
208
|
+
version: 0.22.0
|
|
209
|
+
- !ruby/object:Gem::Dependency
|
|
210
|
+
name: simplecov-cobertura
|
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
|
212
|
+
requirements:
|
|
213
|
+
- - "~>"
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: 2.1.0
|
|
216
|
+
type: :development
|
|
217
|
+
prerelease: false
|
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - "~>"
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: 2.1.0
|
|
223
|
+
- !ruby/object:Gem::Dependency
|
|
224
|
+
name: simplecov-html
|
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
|
226
|
+
requirements:
|
|
227
|
+
- - "~>"
|
|
228
|
+
- !ruby/object:Gem::Version
|
|
229
|
+
version: 0.12.3
|
|
230
|
+
type: :development
|
|
231
|
+
prerelease: false
|
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
233
|
+
requirements:
|
|
234
|
+
- - "~>"
|
|
235
|
+
- !ruby/object:Gem::Version
|
|
236
|
+
version: 0.12.3
|
|
237
|
+
- !ruby/object:Gem::Dependency
|
|
238
|
+
name: test_file_finder
|
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
|
240
|
+
requirements:
|
|
241
|
+
- - "~>"
|
|
242
|
+
- !ruby/object:Gem::Version
|
|
243
|
+
version: 0.1.4
|
|
244
|
+
type: :development
|
|
245
|
+
prerelease: false
|
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
247
|
+
requirements:
|
|
248
|
+
- - "~>"
|
|
249
|
+
- !ruby/object:Gem::Version
|
|
250
|
+
version: 0.1.4
|
|
153
251
|
description:
|
|
154
252
|
email:
|
|
155
253
|
- gitlab_rubygems@gitlab.com
|
|
@@ -171,6 +269,7 @@ files:
|
|
|
171
269
|
- CONTRIBUTING.md
|
|
172
270
|
- Dangerfile
|
|
173
271
|
- Gemfile
|
|
272
|
+
- Gemfile.lock
|
|
174
273
|
- LICENSE.md
|
|
175
274
|
- README.md
|
|
176
275
|
- Rakefile
|
|
@@ -201,6 +300,8 @@ files:
|
|
|
201
300
|
- lib/rubocop/cop/gitlab_security/system_command_injection.rb
|
|
202
301
|
- lib/rubocop/cop/in_batches.rb
|
|
203
302
|
- lib/rubocop/cop/internal_affairs/deprecate_cop_helper.rb
|
|
303
|
+
- lib/rubocop/cop/internal_affairs/missing_cop_department.rb
|
|
304
|
+
- lib/rubocop/cop/internal_affairs/use_restrict_on_send.rb
|
|
204
305
|
- lib/rubocop/cop/line_break_after_guard_clauses.rb
|
|
205
306
|
- lib/rubocop/cop/line_break_around_conditional_block.rb
|
|
206
307
|
- lib/rubocop/cop/migration/update_large_table.rb
|
|
@@ -212,8 +313,11 @@ files:
|
|
|
212
313
|
- lib/rubocop/cop/rspec/empty_line_after_let_block.rb
|
|
213
314
|
- lib/rubocop/cop/rspec/empty_line_after_shared_example.rb
|
|
214
315
|
- lib/rubocop/cop/rspec/example_starting_character.rb
|
|
316
|
+
- lib/rubocop/cop/rspec/factory_bot/excessive_create_list.rb
|
|
215
317
|
- lib/rubocop/cop/rspec/have_link_parameters.rb
|
|
216
318
|
- lib/rubocop/cop/rspec/single_line_hook.rb
|
|
319
|
+
- lib/rubocop/cop/rspec/specify_expected.rb
|
|
320
|
+
- lib/rubocop/cop/rspec/useless_dynamic_definition.rb
|
|
217
321
|
- lib/rubocop/cop/rspec/verbose_include_metadata.rb
|
|
218
322
|
- lib/rubocop/cop/style/hash_transformation.rb
|
|
219
323
|
- lib/rubocop/cop/style/open_struct_use.rb
|
|
@@ -226,6 +330,7 @@ files:
|
|
|
226
330
|
- rubocop-fips.yml
|
|
227
331
|
- rubocop-gemspec.yml
|
|
228
332
|
- rubocop-graphql.yml
|
|
333
|
+
- rubocop-internal-affairs.yml
|
|
229
334
|
- rubocop-layout.yml
|
|
230
335
|
- rubocop-lint.yml
|
|
231
336
|
- rubocop-metrics.yml
|