gitlab-dangerfiles 4.10.0 → 4.11.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 +1 -0
- data/.gitlab-ci.yml +2 -1
- data/.rubocop.yml +11 -2
- data/.rubocop_todo.yml +55 -128
- data/.tool-versions +1 -0
- data/Gemfile.lock +1 -1
- data/lefthook.yml +5 -0
- data/lib/danger/plugins/commit_messages.rb +140 -0
- data/lib/danger/plugins/internal/helper.rb +0 -2
- data/lib/danger/plugins/roulette.rb +9 -1
- data/lib/danger/rules/commit_messages/Dangerfile +1 -123
- data/lib/gitlab/dangerfiles/approval.rb +1 -1
- data/lib/gitlab/dangerfiles/capability.rb +0 -14
- data/lib/gitlab/dangerfiles/commit_linter.rb +2 -2
- data/lib/gitlab/dangerfiles/spec_helper.rb +1 -49
- data/lib/gitlab/dangerfiles/spinner.rb +1 -14
- data/lib/gitlab/dangerfiles/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c8243740c97ac8d208ff6439af1a7651dc5b9ddded13cb3979ea9cadbe6755e
|
|
4
|
+
data.tar.gz: bcfe0970b1dd0ab065d947c9cc9dac727366ccea22dcedf21d61bc9374885c23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91cea0b62fe4490a78abddd4b36bd361895f05b6a40ed6d656e9435905748247689fba0d4f29ab39921b1f32e1d5f62a87fa034b8ce71c311d69d5b70b2685c4
|
|
7
|
+
data.tar.gz: d5ea002f3a5a2db4d8b70dde8c8cbe4ef1eb95c18dfd20f36245efacc1f12fadaabe6f677a5256afaa9534b68a881ff3eb67ae7c4e60c753a4a2bf48f3b5cc13
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -16,8 +16,17 @@ Rails:
|
|
|
16
16
|
CodeReuse/ActiveRecord:
|
|
17
17
|
Enabled: false
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
RSpec/ContextWording:
|
|
20
|
+
Prefixes:
|
|
21
|
+
- 'when'
|
|
22
|
+
- 'with'
|
|
23
|
+
- 'without'
|
|
24
|
+
- 'for'
|
|
25
|
+
- 'and'
|
|
26
|
+
- 'on'
|
|
27
|
+
- 'in'
|
|
28
|
+
- 'as'
|
|
29
|
+
- 'if'
|
|
21
30
|
|
|
22
31
|
RSpec/MultipleMemoizedHelpers:
|
|
23
32
|
Max: 35
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
2
|
+
# `rubocop --auto-gen-config --no-exclude-limit`
|
|
3
|
+
# on 2025-09-22 19:54:32 UTC using RuboCop version 1.43.0.
|
|
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
|
|
@@ -11,7 +11,7 @@ Fips/MD5:
|
|
|
11
11
|
Exclude:
|
|
12
12
|
- 'lib/danger/plugins/roulette.rb'
|
|
13
13
|
|
|
14
|
-
# Offense count:
|
|
14
|
+
# Offense count: 4
|
|
15
15
|
# This cop supports safe autocorrection (--autocorrect).
|
|
16
16
|
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
|
17
17
|
# Include: **/*.gemspec
|
|
@@ -21,27 +21,19 @@ Gemspec/OrderedDependencies:
|
|
|
21
21
|
|
|
22
22
|
# Offense count: 1
|
|
23
23
|
# This cop supports safe autocorrection (--autocorrect).
|
|
24
|
-
# Configuration parameters: Include.
|
|
24
|
+
# Configuration parameters: Severity, Include.
|
|
25
25
|
# Include: **/*.gemspec
|
|
26
26
|
Gemspec/RequireMFA:
|
|
27
27
|
Exclude:
|
|
28
28
|
- 'gitlab-dangerfiles.gemspec'
|
|
29
29
|
|
|
30
30
|
# Offense count: 1
|
|
31
|
-
# Configuration parameters: Include.
|
|
31
|
+
# Configuration parameters: Severity, Include.
|
|
32
32
|
# Include: **/*.gemspec
|
|
33
33
|
Gemspec/RequiredRubyVersion:
|
|
34
34
|
Exclude:
|
|
35
35
|
- 'gitlab-dangerfiles.gemspec'
|
|
36
36
|
|
|
37
|
-
# Offense count: 1
|
|
38
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
39
|
-
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
|
40
|
-
# SupportedStylesAlignWith: start_of_line, begin
|
|
41
|
-
Layout/BeginEndAlignment:
|
|
42
|
-
Exclude:
|
|
43
|
-
- 'lib/danger/plugins/roulette.rb'
|
|
44
|
-
|
|
45
37
|
# Offense count: 6
|
|
46
38
|
# This cop supports safe autocorrection (--autocorrect).
|
|
47
39
|
Layout/ElseAlignment:
|
|
@@ -60,14 +52,12 @@ Layout/EndAlignment:
|
|
|
60
52
|
- 'lib/danger/plugins/internal/helper.rb'
|
|
61
53
|
- 'lib/gitlab/dangerfiles/teammate.rb'
|
|
62
54
|
|
|
63
|
-
# Offense count:
|
|
55
|
+
# Offense count: 1
|
|
64
56
|
# This cop supports safe autocorrection (--autocorrect).
|
|
65
|
-
# Configuration parameters:
|
|
57
|
+
# Configuration parameters: IndentationWidth.
|
|
66
58
|
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
|
67
59
|
Layout/FirstArrayElementIndentation:
|
|
68
|
-
|
|
69
|
-
- 'spec/danger/plugins/roulette_spec.rb'
|
|
70
|
-
- 'spec/gitlab/dangerfiles_spec.rb'
|
|
60
|
+
EnforcedStyle: consistent
|
|
71
61
|
|
|
72
62
|
# Offense count: 6
|
|
73
63
|
# This cop supports safe autocorrection (--autocorrect).
|
|
@@ -86,12 +76,6 @@ Layout/LineEndStringConcatenationIndentation:
|
|
|
86
76
|
Exclude:
|
|
87
77
|
- 'lib/gitlab/dangerfiles/commit_linter.rb'
|
|
88
78
|
|
|
89
|
-
# Offense count: 1
|
|
90
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
91
|
-
Layout/RescueEnsureAlignment:
|
|
92
|
-
Exclude:
|
|
93
|
-
- 'lib/danger/plugins/roulette.rb'
|
|
94
|
-
|
|
95
79
|
# Offense count: 11
|
|
96
80
|
# This cop supports safe autocorrection (--autocorrect).
|
|
97
81
|
Lint/AmbiguousOperatorPrecedence:
|
|
@@ -107,12 +91,6 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
|
107
91
|
Exclude:
|
|
108
92
|
- 'spec/gitlab/dangerfiles/teammate_spec.rb'
|
|
109
93
|
|
|
110
|
-
# Offense count: 2
|
|
111
|
-
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
|
|
112
|
-
Lint/DuplicateBranch:
|
|
113
|
-
Exclude:
|
|
114
|
-
- 'lib/danger/plugins/roulette.rb'
|
|
115
|
-
|
|
116
94
|
# Offense count: 2
|
|
117
95
|
# This cop supports safe autocorrection (--autocorrect).
|
|
118
96
|
Lint/DuplicateRegexpCharacterClassElement:
|
|
@@ -148,28 +126,20 @@ Naming/FileName:
|
|
|
148
126
|
Exclude:
|
|
149
127
|
- 'lib/gitlab-dangerfiles.rb'
|
|
150
128
|
|
|
151
|
-
# Offense count:
|
|
129
|
+
# Offense count: 2
|
|
152
130
|
# This cop supports safe autocorrection (--autocorrect).
|
|
153
131
|
# Configuration parameters: PreferredName.
|
|
154
132
|
Naming/RescuedExceptionsVariableName:
|
|
155
133
|
Exclude:
|
|
156
134
|
- 'lib/danger/plugins/changelog.rb'
|
|
157
|
-
- 'lib/danger/plugins/roulette.rb'
|
|
158
135
|
|
|
159
|
-
# Offense count:
|
|
160
|
-
# Configuration parameters: MinSize.
|
|
161
|
-
Performance/CollectionLiteralInLoop:
|
|
162
|
-
Exclude:
|
|
163
|
-
- 'spec/danger/plugins/roulette_spec.rb'
|
|
164
|
-
|
|
165
|
-
# Offense count: 5
|
|
136
|
+
# Offense count: 3
|
|
166
137
|
Performance/MethodObjectAsBlock:
|
|
167
138
|
Exclude:
|
|
168
|
-
- 'lib/danger/plugins/roulette.rb'
|
|
169
139
|
- 'spec/spec_helper.rb'
|
|
170
140
|
|
|
171
|
-
# Offense count:
|
|
172
|
-
# This cop supports
|
|
141
|
+
# Offense count: 14
|
|
142
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
173
143
|
RSpec/BeEq:
|
|
174
144
|
Exclude:
|
|
175
145
|
- 'spec/danger/plugins/changelog_spec.rb'
|
|
@@ -184,7 +154,7 @@ RSpec/BeNil:
|
|
|
184
154
|
Exclude:
|
|
185
155
|
- 'spec/gitlab/dangerfiles/version_spec.rb'
|
|
186
156
|
|
|
187
|
-
# Offense count:
|
|
157
|
+
# Offense count: 21
|
|
188
158
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
189
159
|
# Prefixes: when, with, without
|
|
190
160
|
RSpec/ContextWording:
|
|
@@ -206,7 +176,7 @@ RSpec/EmptyLineAfterLetBlock:
|
|
|
206
176
|
Exclude:
|
|
207
177
|
- 'spec/danger/plugins/internal/helper_spec.rb'
|
|
208
178
|
|
|
209
|
-
# Offense count:
|
|
179
|
+
# Offense count: 8
|
|
210
180
|
RSpec/ExpectInHook:
|
|
211
181
|
Exclude:
|
|
212
182
|
- 'spec/danger/plugins/internal/helper_spec.rb'
|
|
@@ -218,39 +188,28 @@ RSpec/HooksBeforeExamples:
|
|
|
218
188
|
- 'spec/danger/plugins/changelog_spec.rb'
|
|
219
189
|
- 'spec/danger/plugins/roulette_spec.rb'
|
|
220
190
|
|
|
221
|
-
# Offense count:
|
|
191
|
+
# Offense count: 20
|
|
222
192
|
# This cop supports safe autocorrection (--autocorrect).
|
|
223
193
|
# Configuration parameters: EnforcedStyle.
|
|
224
|
-
# SupportedStyles: single_line_only, single_statement_only, disallow
|
|
194
|
+
# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit
|
|
225
195
|
RSpec/ImplicitSubject:
|
|
226
196
|
Exclude:
|
|
227
197
|
- 'spec/danger/plugins/changelog_spec.rb'
|
|
228
198
|
- 'spec/danger/plugins/internal/helper_spec.rb'
|
|
229
|
-
- 'spec/danger/plugins/roulette_spec.rb'
|
|
230
199
|
|
|
231
|
-
# Offense count:
|
|
200
|
+
# Offense count: 9
|
|
232
201
|
# This cop supports safe autocorrection (--autocorrect).
|
|
233
202
|
RSpec/LetBeforeExamples:
|
|
234
203
|
Exclude:
|
|
235
204
|
- 'spec/danger/plugins/internal/helper_spec.rb'
|
|
236
205
|
- 'spec/danger/plugins/roulette_spec.rb'
|
|
237
206
|
|
|
238
|
-
# Offense count: 51
|
|
239
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
240
|
-
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
|
|
241
|
-
# SupportedStyles: inflected, explicit
|
|
242
|
-
RSpec/PredicateMatcher:
|
|
243
|
-
Exclude:
|
|
244
|
-
- 'spec/danger/plugins/changelog_spec.rb'
|
|
245
|
-
- 'spec/danger/plugins/internal/helper_spec.rb'
|
|
246
|
-
- 'spec/gitlab/dangerfiles/teammate_spec.rb'
|
|
247
|
-
|
|
248
207
|
# Offense count: 2
|
|
249
208
|
RSpec/RepeatedExampleGroupDescription:
|
|
250
209
|
Exclude:
|
|
251
210
|
- 'spec/gitlab/dangerfiles/commit_linter_spec.rb'
|
|
252
211
|
|
|
253
|
-
# Offense count:
|
|
212
|
+
# Offense count: 37
|
|
254
213
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
|
255
214
|
RSpec/VerifiedDoubles:
|
|
256
215
|
Exclude:
|
|
@@ -276,12 +235,11 @@ Style/ExpandPathArguments:
|
|
|
276
235
|
Exclude:
|
|
277
236
|
- 'gitlab-dangerfiles.gemspec'
|
|
278
237
|
|
|
279
|
-
# Offense count:
|
|
238
|
+
# Offense count: 2
|
|
280
239
|
# This cop supports safe autocorrection (--autocorrect).
|
|
281
240
|
# Configuration parameters: AllowedVars.
|
|
282
241
|
Style/FetchEnvVar:
|
|
283
242
|
Exclude:
|
|
284
|
-
- 'lib/danger/rules/commit_messages/Dangerfile'
|
|
285
243
|
- 'lib/danger/rules/z_retry_link/Dangerfile'
|
|
286
244
|
- 'lib/gitlab/dangerfiles/config.rb'
|
|
287
245
|
|
|
@@ -294,21 +252,32 @@ Style/FormatString:
|
|
|
294
252
|
- 'lib/danger/rules/simple_roulette/Dangerfile'
|
|
295
253
|
- 'lib/gitlab/dangerfiles/base_linter.rb'
|
|
296
254
|
|
|
297
|
-
# Offense count:
|
|
255
|
+
# Offense count: 17
|
|
298
256
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
299
257
|
# Configuration parameters: EnforcedStyle.
|
|
300
258
|
# SupportedStyles: always, always_true, never
|
|
301
259
|
Style/FrozenStringLiteralComment:
|
|
302
|
-
Enabled: false
|
|
303
|
-
|
|
304
|
-
# Offense count: 2
|
|
305
|
-
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
|
306
|
-
Style/GuardClause:
|
|
307
260
|
Exclude:
|
|
308
|
-
- '
|
|
261
|
+
- 'Dangerfile'
|
|
262
|
+
- 'Gemfile'
|
|
263
|
+
- 'Guardfile'
|
|
264
|
+
- 'Rakefile'
|
|
265
|
+
- 'gitlab-dangerfiles.gemspec'
|
|
266
|
+
- 'lib/danger/rules/z_add_labels/Dangerfile'
|
|
267
|
+
- 'lib/danger/rules/z_retry_link/Dangerfile'
|
|
268
|
+
- 'lib/gitlab-dangerfiles.rb'
|
|
269
|
+
- 'lib/gitlab/Dangerfile'
|
|
270
|
+
- 'lib/gitlab/dangerfiles.rb'
|
|
271
|
+
- 'lib/gitlab/dangerfiles/commit_messages_helper.rb'
|
|
272
|
+
- 'lib/gitlab/dangerfiles/spec_helper.rb'
|
|
273
|
+
- 'lib/gitlab/dangerfiles/task_loader.rb'
|
|
274
|
+
- 'lib/gitlab/dangerfiles/version.rb'
|
|
275
|
+
- 'spec/gitlab/dangerfiles/version_spec.rb'
|
|
276
|
+
- 'spec/spec_helper.rb'
|
|
277
|
+
- 'spec/support/danger_spec_helper.rb'
|
|
309
278
|
|
|
310
279
|
# Offense count: 2
|
|
311
|
-
# This cop supports
|
|
280
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
312
281
|
Style/HashExcept:
|
|
313
282
|
Exclude:
|
|
314
283
|
- 'lib/gitlab/dangerfiles.rb'
|
|
@@ -322,34 +291,24 @@ Style/HashSyntax:
|
|
|
322
291
|
Exclude:
|
|
323
292
|
- 'Rakefile'
|
|
324
293
|
|
|
325
|
-
# Offense count:
|
|
326
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
327
|
-
# Configuration parameters: AllowIfModifier.
|
|
328
|
-
Style/IfInsideElse:
|
|
329
|
-
Exclude:
|
|
330
|
-
- 'lib/danger/rules/commit_messages/Dangerfile'
|
|
331
|
-
|
|
332
|
-
# Offense count: 22
|
|
294
|
+
# Offense count: 18
|
|
333
295
|
# This cop supports safe autocorrection (--autocorrect).
|
|
334
296
|
Style/IfUnlessModifier:
|
|
335
297
|
Exclude:
|
|
336
298
|
- 'lib/danger/plugins/changelog.rb'
|
|
337
299
|
- 'lib/danger/plugins/roulette.rb'
|
|
338
|
-
- 'lib/danger/rules/commit_messages/Dangerfile'
|
|
339
|
-
- 'lib/danger/rules/commits_counter/Dangerfile'
|
|
340
300
|
- 'lib/danger/rules/simple_roulette/Dangerfile'
|
|
341
301
|
- 'lib/danger/rules/z_retry_link/Dangerfile'
|
|
342
302
|
- 'lib/gitlab/dangerfiles.rb'
|
|
343
303
|
- 'lib/gitlab/dangerfiles/base_linter.rb'
|
|
344
304
|
- 'lib/gitlab/dangerfiles/commit_linter.rb'
|
|
345
305
|
|
|
346
|
-
# Offense count:
|
|
306
|
+
# Offense count: 2
|
|
347
307
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
348
308
|
# Configuration parameters: EnforcedStyle.
|
|
349
309
|
# SupportedStyles: literals, strict
|
|
350
310
|
Style/MutableConstant:
|
|
351
311
|
Exclude:
|
|
352
|
-
- 'lib/danger/rules/commit_messages/Dangerfile'
|
|
353
312
|
- 'lib/danger/rules/simple_roulette/Dangerfile'
|
|
354
313
|
- 'lib/gitlab/dangerfiles/version.rb'
|
|
355
314
|
|
|
@@ -370,7 +329,7 @@ Style/NumericPredicate:
|
|
|
370
329
|
- 'lib/danger/plugins/roulette.rb'
|
|
371
330
|
- 'lib/gitlab/dangerfiles/teammate.rb'
|
|
372
331
|
|
|
373
|
-
# Offense count:
|
|
332
|
+
# Offense count: 7
|
|
374
333
|
# This cop supports safe autocorrection (--autocorrect).
|
|
375
334
|
# Configuration parameters: PreferredDelimiters.
|
|
376
335
|
Style/PercentLiteralDelimiters:
|
|
@@ -381,7 +340,7 @@ Style/PercentLiteralDelimiters:
|
|
|
381
340
|
- 'lib/gitlab/dangerfiles/tasks/main.rake'
|
|
382
341
|
- 'spec/danger/plugins/internal/helper_spec.rb'
|
|
383
342
|
|
|
384
|
-
# Offense count:
|
|
343
|
+
# Offense count: 10
|
|
385
344
|
# This cop supports safe autocorrection (--autocorrect).
|
|
386
345
|
# Configuration parameters: .
|
|
387
346
|
# SupportedStyles: same_as_string_literals, single_quotes, double_quotes
|
|
@@ -405,7 +364,7 @@ Style/RedundantFreeze:
|
|
|
405
364
|
- 'lib/gitlab/dangerfiles/emoji_checker.rb'
|
|
406
365
|
- 'lib/gitlab/dangerfiles/title_linting.rb'
|
|
407
366
|
|
|
408
|
-
# Offense count:
|
|
367
|
+
# Offense count: 5
|
|
409
368
|
# This cop supports safe autocorrection (--autocorrect).
|
|
410
369
|
Style/RedundantRegexpEscape:
|
|
411
370
|
Exclude:
|
|
@@ -413,13 +372,7 @@ Style/RedundantRegexpEscape:
|
|
|
413
372
|
- 'lib/gitlab/dangerfiles/emoji_checker.rb'
|
|
414
373
|
- 'lib/gitlab/dangerfiles/title_linting.rb'
|
|
415
374
|
|
|
416
|
-
# Offense count:
|
|
417
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
418
|
-
Style/RedundantSelf:
|
|
419
|
-
Exclude:
|
|
420
|
-
- 'lib/danger/rules/commit_messages/Dangerfile'
|
|
421
|
-
|
|
422
|
-
# Offense count: 2
|
|
375
|
+
# Offense count: 3
|
|
423
376
|
# This cop supports safe autocorrection (--autocorrect).
|
|
424
377
|
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
|
425
378
|
# SupportedStyles: slashes, percent_r, mixed
|
|
@@ -434,7 +387,7 @@ Style/RescueModifier:
|
|
|
434
387
|
Exclude:
|
|
435
388
|
- 'lib/gitlab/dangerfiles/commit_linter.rb'
|
|
436
389
|
|
|
437
|
-
# Offense count:
|
|
390
|
+
# Offense count: 2
|
|
438
391
|
# This cop supports safe autocorrection (--autocorrect).
|
|
439
392
|
# Configuration parameters: EnforcedStyle.
|
|
440
393
|
# SupportedStyles: implicit, explicit
|
|
@@ -442,15 +395,6 @@ Style/RescueStandardError:
|
|
|
442
395
|
Exclude:
|
|
443
396
|
- 'lib/danger/plugins/changelog.rb'
|
|
444
397
|
- 'lib/danger/plugins/internal/helper.rb'
|
|
445
|
-
- 'lib/danger/plugins/roulette.rb'
|
|
446
|
-
|
|
447
|
-
# Offense count: 1
|
|
448
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
449
|
-
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
|
450
|
-
# AllowedMethods: present?, blank?, presence, try, try!
|
|
451
|
-
Style/SafeNavigation:
|
|
452
|
-
Exclude:
|
|
453
|
-
- 'lib/danger/rules/commit_messages/Dangerfile'
|
|
454
398
|
|
|
455
399
|
# Offense count: 1
|
|
456
400
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
@@ -458,14 +402,6 @@ Style/SelectByRegexp:
|
|
|
458
402
|
Exclude:
|
|
459
403
|
- 'lib/danger/plugins/internal/helper.rb'
|
|
460
404
|
|
|
461
|
-
# Offense count: 2
|
|
462
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
463
|
-
# Configuration parameters: EnforcedStyle.
|
|
464
|
-
# SupportedStyles: only_raise, only_fail, semantic
|
|
465
|
-
Style/SignalException:
|
|
466
|
-
Exclude:
|
|
467
|
-
- 'lib/danger/rules/type_label/Dangerfile'
|
|
468
|
-
|
|
469
405
|
# Offense count: 7
|
|
470
406
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
471
407
|
# Configuration parameters: Mode.
|
|
@@ -475,35 +411,24 @@ Style/StringConcatenation:
|
|
|
475
411
|
- 'spec/gitlab/dangerfiles/commit_linter_spec.rb'
|
|
476
412
|
- 'spec/gitlab/merge_request_linter_spec.rb'
|
|
477
413
|
|
|
478
|
-
# Offense count:
|
|
414
|
+
# Offense count: 4
|
|
479
415
|
# This cop supports safe autocorrection (--autocorrect).
|
|
480
416
|
# Configuration parameters: EnforcedStyle.
|
|
481
417
|
# SupportedStyles: single_quotes, double_quotes
|
|
482
418
|
Style/StringLiteralsInInterpolation:
|
|
483
419
|
Exclude:
|
|
484
420
|
- 'lib/danger/plugins/internal/helper.rb'
|
|
485
|
-
- 'lib/danger/plugins/roulette.rb'
|
|
486
|
-
- 'lib/danger/rules/commit_messages/Dangerfile'
|
|
487
421
|
- 'spec/gitlab/dangerfiles/teammate_spec.rb'
|
|
488
422
|
|
|
489
|
-
# Offense count:
|
|
423
|
+
# Offense count: 1
|
|
490
424
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
491
425
|
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowComments.
|
|
492
|
-
# AllowedMethods:
|
|
426
|
+
# AllowedMethods: define_method, mail, respond_to
|
|
493
427
|
Style/SymbolProc:
|
|
494
428
|
Exclude:
|
|
495
|
-
- 'lib/danger/rules/commit_messages/Dangerfile'
|
|
496
429
|
- 'spec/gitlab/dangerfiles_spec.rb'
|
|
497
430
|
|
|
498
|
-
# Offense count:
|
|
499
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
500
|
-
# Configuration parameters: EnforcedStyleForMultiline.
|
|
501
|
-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
502
|
-
Style/TrailingCommaInArguments:
|
|
503
|
-
Exclude:
|
|
504
|
-
- 'spec/danger/plugins/roulette_spec.rb'
|
|
505
|
-
|
|
506
|
-
# Offense count: 24
|
|
431
|
+
# Offense count: 25
|
|
507
432
|
# This cop supports safe autocorrection (--autocorrect).
|
|
508
433
|
# Configuration parameters: EnforcedStyleForMultiline.
|
|
509
434
|
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
@@ -520,7 +445,9 @@ Style/TrailingCommaInArrayLiteral:
|
|
|
520
445
|
- 'spec/gitlab/dangerfiles/weightage/maintainers_spec.rb'
|
|
521
446
|
- 'spec/gitlab/dangerfiles/weightage/reviewers_spec.rb'
|
|
522
447
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
448
|
+
# Offense count: 111
|
|
449
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
450
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
|
451
|
+
# URISchemes: http, https
|
|
452
|
+
Layout/LineLength:
|
|
453
|
+
Max: 374
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.2.9
|
data/Gemfile.lock
CHANGED
data/lefthook.yml
CHANGED
|
@@ -12,3 +12,8 @@ pre-push:
|
|
|
12
12
|
rubocop:
|
|
13
13
|
run: bundle exec rubocop
|
|
14
14
|
glob: '*.rb'
|
|
15
|
+
|
|
16
|
+
danger:
|
|
17
|
+
files: git diff --name-only $(git merge-base origin/master HEAD)..HEAD
|
|
18
|
+
# We need to specify {files} as part of the command, otherwise it won't execute the hook
|
|
19
|
+
run: echo {files} >/dev/null && bundle exec danger dry_run
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../gitlab/dangerfiles/commit_linter"
|
|
4
|
+
require_relative "../../gitlab/dangerfiles/merge_request_linter"
|
|
5
|
+
|
|
6
|
+
module Danger
|
|
7
|
+
# Common helper functions for our danger scripts. See Danger::Helper
|
|
8
|
+
# for more details
|
|
9
|
+
class CommitMessages < Danger::Plugin
|
|
10
|
+
COMMIT_MSG_DOC = "https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#commit-messages-guidelines"
|
|
11
|
+
MORE_INFO = "For more information, take a look at our [Commit message guidelines](#{COMMIT_MSG_DOC}).".freeze
|
|
12
|
+
THE_DANGER_JOB_TEXT = "the `%<job_name>s` job"
|
|
13
|
+
MAX_COMMITS_COUNT_EXCEEDED_MESSAGE = <<~MSG
|
|
14
|
+
This merge request includes more than %<max_commits_count>d commits. Each commit should meet the following criteria:
|
|
15
|
+
|
|
16
|
+
1. Have a well-written commit message.
|
|
17
|
+
1. Has all tests passing when used on its own (e.g. when using git checkout SHA).
|
|
18
|
+
1. Can be reverted on its own without also requiring the revert of commit that came before it.
|
|
19
|
+
1. Is small enough that it can be reviewed in isolation in under 30 minutes or so.
|
|
20
|
+
|
|
21
|
+
If this merge request contains commits that do not meet this criteria and/or contains intermediate work, please rebase these commits into a smaller number of commits or split this merge request into multiple smaller merge requests.
|
|
22
|
+
MSG
|
|
23
|
+
|
|
24
|
+
def build_message(commit, message, more_info: true)
|
|
25
|
+
[message].tap do |full_message|
|
|
26
|
+
full_message << ". #{MORE_INFO}" if more_info
|
|
27
|
+
full_message.unshift("#{commit.sha}: ") if commit.sha
|
|
28
|
+
end.join
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def fail_commit(commit, message, more_info: true)
|
|
32
|
+
self.fail(build_message(commit, message, more_info: more_info))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def warn_commit(commit, message, more_info: true)
|
|
36
|
+
self.warn(build_message(commit, message, more_info: more_info))
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def danger_job_link
|
|
40
|
+
if helper.ci?
|
|
41
|
+
"[#{format(THE_DANGER_JOB_TEXT, job_name: ENV.fetch('CI_JOB_NAME', nil))}](#{ENV.fetch('CI_JOB_URL', nil)})"
|
|
42
|
+
else
|
|
43
|
+
THE_DANGER_JOB_TEXT
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Perform various checks against commits. We're not using
|
|
48
|
+
# https://github.com/jonallured/danger-commit_lint because its output is not
|
|
49
|
+
# very helpful, and it doesn't offer the means of ignoring merge commits.
|
|
50
|
+
def lint_commit(commit)
|
|
51
|
+
linter = Gitlab::Dangerfiles::CommitLinter.new(commit)
|
|
52
|
+
|
|
53
|
+
# For now we'll ignore merge commits, as getting rid of those is a problem
|
|
54
|
+
# separate from enforcing good commit messages.
|
|
55
|
+
return linter if linter.merge?
|
|
56
|
+
|
|
57
|
+
# We ignore revert commits as they are well structured by Git already
|
|
58
|
+
return linter if linter.revert?
|
|
59
|
+
|
|
60
|
+
# If MR is set to squash, we ignore fixup commits
|
|
61
|
+
return linter if linter.fixup? && helper.squash_mr?
|
|
62
|
+
|
|
63
|
+
if linter.fixup?
|
|
64
|
+
msg = "Squash or fixup commits must be squashed before merge, or **edit** the merge request, " \
|
|
65
|
+
"enable **Squash commits when merge request is accepted** and re-run #{danger_job_link}."
|
|
66
|
+
|
|
67
|
+
if helper.draft_mr? || helper.squash_mr?
|
|
68
|
+
warn_commit(commit, msg, more_info: false)
|
|
69
|
+
else
|
|
70
|
+
fail_commit(commit, msg, more_info: false)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Makes no sense to process other rules for fixup commits, they trigger just more noise
|
|
74
|
+
return linter
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Fail if a suggestion commit is used and squash is not enabled
|
|
78
|
+
if linter.suggestion?
|
|
79
|
+
unless helper.squash_mr?
|
|
80
|
+
msg = "If you are applying suggestions, **edit** the merge request, enable **Squash commits when " \
|
|
81
|
+
"merge request is accepted** and re-run #{danger_job_link}."
|
|
82
|
+
fail_commit(commit, msg, more_info: false)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
return linter
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
linter.lint
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def lint_mr_title(mr_title)
|
|
92
|
+
commit = Struct.new(:message, :sha).new(mr_title)
|
|
93
|
+
|
|
94
|
+
Gitlab::Dangerfiles::MergeRequestLinter.new(commit).lint
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def count_non_fixup_commits(commit_linters)
|
|
98
|
+
commit_linters.count { |commit_linter| !commit_linter.fixup? }
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def lint_commits(commits)
|
|
102
|
+
commit_linters = commits.map { |commit| lint_commit(commit) }
|
|
103
|
+
|
|
104
|
+
if helper.squash_mr?
|
|
105
|
+
multi_line_commit_linter = commit_linters.detect do |commit_linter|
|
|
106
|
+
!commit_linter.merge? && commit_linter.multi_line?
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if multi_line_commit_linter&.failed?
|
|
110
|
+
warn_or_fail_commits(multi_line_commit_linter)
|
|
111
|
+
commit_linters.delete(multi_line_commit_linter) # Don't show an error (here) and a warning (below)
|
|
112
|
+
end
|
|
113
|
+
elsif count_non_fixup_commits(commit_linters) > max_commits_count
|
|
114
|
+
self.warn(format(MAX_COMMITS_COUNT_EXCEEDED_MESSAGE, max_commits_count: max_commits_count))
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
failed_commit_linters = commit_linters.select(&:failed?)
|
|
118
|
+
warn_or_fail_commits(failed_commit_linters, default_to_fail: !helper.squash_mr?)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def max_commits_count
|
|
122
|
+
helper.config.max_commits_count
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def warn_or_fail_commits(failed_linters, default_to_fail: true)
|
|
126
|
+
level = default_to_fail ? :fail : :warn
|
|
127
|
+
|
|
128
|
+
Array(failed_linters).each do |linter|
|
|
129
|
+
linter.problems.each do |problem_key, problem_desc|
|
|
130
|
+
case problem_key
|
|
131
|
+
when :subject_too_short, :details_too_many_changes, :details_line_too_long
|
|
132
|
+
warn_commit(linter.commit, problem_desc)
|
|
133
|
+
else
|
|
134
|
+
__send__(:"#{level}_commit", linter.commit, problem_desc)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -25,8 +25,6 @@ module Danger
|
|
|
25
25
|
pipeline: '~"maintenance::pipelines" for CI',
|
|
26
26
|
ci_template: '~"ci::templates"',
|
|
27
27
|
analytics_instrumentation: '~"analytics instrumentation"',
|
|
28
|
-
import_integrate_be: '~"group::import and integrate" (backend)',
|
|
29
|
-
import_integrate_fe: '~"group::import and integrate" (frontend)',
|
|
30
28
|
Authentication: '~"group::authentication"',
|
|
31
29
|
Authorization: '~"group::authorization"',
|
|
32
30
|
Compliance: '~"group::compliance"',
|
|
@@ -9,6 +9,7 @@ module Danger
|
|
|
9
9
|
# for more details
|
|
10
10
|
class Roulette < Danger::Plugin
|
|
11
11
|
HOURS_WHEN_PERSON_CAN_BE_PICKED = (6..14).freeze
|
|
12
|
+
BOT_REVIEWERS = %w[GitLabDuo].freeze
|
|
12
13
|
HTTPError = Class.new(StandardError)
|
|
13
14
|
|
|
14
15
|
def prepare_categories(changes_keys)
|
|
@@ -91,7 +92,7 @@ module Danger
|
|
|
91
92
|
#
|
|
92
93
|
# @param spins [Array<Spin>] The roulette spins to potentially assign from
|
|
93
94
|
def assign_reviewers_from_roulette(spins)
|
|
94
|
-
return if
|
|
95
|
+
return if human_reviewers?
|
|
95
96
|
|
|
96
97
|
reviewers_to_assign = find_reviewers_to_assign(spins)
|
|
97
98
|
|
|
@@ -188,6 +189,13 @@ module Danger
|
|
|
188
189
|
@labels ||= helper.mr_labels
|
|
189
190
|
end
|
|
190
191
|
|
|
192
|
+
# Checks if any non-bot reviewers are already assigned to the merge request
|
|
193
|
+
#
|
|
194
|
+
# @return [Boolean]
|
|
195
|
+
def human_reviewers?
|
|
196
|
+
helper.mr_reviewers.any? { |reviewer| !BOT_REVIEWERS.include?(reviewer["username"]) }
|
|
197
|
+
end
|
|
198
|
+
|
|
191
199
|
# Find reviewers to assign based on configured roles
|
|
192
200
|
#
|
|
193
201
|
# @param spins [Array<Spin>] The roulette spins
|
|
@@ -1,127 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "../../../gitlab/dangerfiles/commit_linter"
|
|
4
|
-
require_relative "../../../gitlab/dangerfiles/merge_request_linter"
|
|
5
|
-
|
|
6
|
-
COMMIT_MESSAGE_GUIDELINES = "https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#commit-messages-guidelines"
|
|
7
|
-
MORE_INFO = "For more information, take a look at our [Commit message guidelines](#{COMMIT_MESSAGE_GUIDELINES})."
|
|
8
|
-
THE_DANGER_JOB_TEXT = "the `%<job_name>s` job"
|
|
9
|
-
MAX_COMMITS_COUNT = helper.config.max_commits_count
|
|
10
|
-
MAX_COMMITS_COUNT_EXCEEDED_MESSAGE = <<~MSG
|
|
11
|
-
This merge request includes more than %<max_commits_count>d commits. Each commit should meet the following criteria:
|
|
12
|
-
|
|
13
|
-
1. Have a well-written commit message.
|
|
14
|
-
1. Has all tests passing when used on its own (e.g. when using git checkout SHA).
|
|
15
|
-
1. Can be reverted on its own without also requiring the revert of commit that came before it.
|
|
16
|
-
1. Is small enough that it can be reviewed in isolation in under 30 minutes or so.
|
|
17
|
-
|
|
18
|
-
If this merge request contains commits that do not meet this criteria and/or contains intermediate work, please rebase these commits into a smaller number of commits or split this merge request into multiple smaller merge requests.
|
|
19
|
-
MSG
|
|
20
|
-
|
|
21
|
-
def fail_commit(commit, message, more_info: true)
|
|
22
|
-
self.fail(build_message(commit, message, more_info: more_info))
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def warn_commit(commit, message, more_info: true)
|
|
26
|
-
self.warn(build_message(commit, message, more_info: more_info))
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def build_message(commit, message, more_info: true)
|
|
30
|
-
[message].tap do |full_message|
|
|
31
|
-
full_message << ". #{MORE_INFO}" if more_info
|
|
32
|
-
full_message.unshift("#{commit.sha}: ") if commit.sha
|
|
33
|
-
end.join
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def danger_job_link
|
|
37
|
-
helper.ci? ? "[#{format(THE_DANGER_JOB_TEXT, job_name: ENV["CI_JOB_NAME"])}](#{ENV['CI_JOB_URL']})" : THE_DANGER_JOB_TEXT
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Perform various checks against commits. We're not using
|
|
41
|
-
# https://github.com/jonallured/danger-commit_lint because its output is not
|
|
42
|
-
# very helpful, and it doesn't offer the means of ignoring merge commits.
|
|
43
|
-
def lint_commit(commit)
|
|
44
|
-
linter = Gitlab::Dangerfiles::CommitLinter.new(commit)
|
|
45
|
-
|
|
46
|
-
# For now we'll ignore merge commits, as getting rid of those is a problem
|
|
47
|
-
# separate from enforcing good commit messages.
|
|
48
|
-
return linter if linter.merge?
|
|
49
|
-
|
|
50
|
-
# We ignore revert commits as they are well structured by Git already
|
|
51
|
-
return linter if linter.revert?
|
|
52
|
-
|
|
53
|
-
# If MR is set to squash, we ignore fixup commits
|
|
54
|
-
return linter if linter.fixup? && helper.squash_mr?
|
|
55
|
-
|
|
56
|
-
if linter.fixup?
|
|
57
|
-
msg = "Squash or fixup commits must be squashed before merge, or **edit** the merge request, enable **Squash commits when merge request is accepted** and re-run #{danger_job_link}."
|
|
58
|
-
if helper.draft_mr? || helper.squash_mr?
|
|
59
|
-
warn_commit(commit, msg, more_info: false)
|
|
60
|
-
else
|
|
61
|
-
fail_commit(commit, msg, more_info: false)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
# Makes no sense to process other rules for fixup commits, they trigger just more noise
|
|
65
|
-
return linter
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# Fail if a suggestion commit is used and squash is not enabled
|
|
69
|
-
if linter.suggestion?
|
|
70
|
-
unless helper.squash_mr?
|
|
71
|
-
fail_commit(commit, "If you are applying suggestions, **edit** the merge request, enable **Squash commits when merge request is accepted** and re-run #{danger_job_link}.", more_info: false)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
return linter
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
linter.lint
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def lint_mr_title(mr_title)
|
|
81
|
-
commit = Struct.new(:message, :sha).new(mr_title)
|
|
82
|
-
|
|
83
|
-
Gitlab::Dangerfiles::MergeRequestLinter.new(commit).lint
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def count_non_fixup_commits(commit_linters)
|
|
87
|
-
commit_linters.count { |commit_linter| !commit_linter.fixup? }
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def lint_commits(commits)
|
|
91
|
-
commit_linters = commits.map { |commit| lint_commit(commit) }
|
|
92
|
-
|
|
93
|
-
if helper.squash_mr?
|
|
94
|
-
multi_line_commit_linter = commit_linters.detect { |commit_linter| !commit_linter.merge? && commit_linter.multi_line? }
|
|
95
|
-
|
|
96
|
-
if multi_line_commit_linter && multi_line_commit_linter.failed?
|
|
97
|
-
warn_or_fail_commits(multi_line_commit_linter)
|
|
98
|
-
commit_linters.delete(multi_line_commit_linter) # Don't show an error (here) and a warning (below)
|
|
99
|
-
end
|
|
100
|
-
else
|
|
101
|
-
if count_non_fixup_commits(commit_linters) > MAX_COMMITS_COUNT
|
|
102
|
-
self.warn(format(MAX_COMMITS_COUNT_EXCEEDED_MESSAGE, max_commits_count: MAX_COMMITS_COUNT))
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
failed_commit_linters = commit_linters.select { |commit_linter| commit_linter.failed? }
|
|
107
|
-
warn_or_fail_commits(failed_commit_linters, default_to_fail: !helper.squash_mr?)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def warn_or_fail_commits(failed_linters, default_to_fail: true)
|
|
111
|
-
level = default_to_fail ? :fail : :warn
|
|
112
|
-
|
|
113
|
-
Array(failed_linters).each do |linter|
|
|
114
|
-
linter.problems.each do |problem_key, problem_desc|
|
|
115
|
-
case problem_key
|
|
116
|
-
when :subject_too_short, :details_too_many_changes, :details_line_too_long
|
|
117
|
-
warn_commit(linter.commit, problem_desc)
|
|
118
|
-
else
|
|
119
|
-
self.__send__(:"#{level}_commit", linter.commit, problem_desc)
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
3
|
# As part of https://gitlab.com/groups/gitlab-org/-/epics/4826 we are
|
|
126
4
|
# vendoring workhorse commits from the stand-alone gitlab-workhorse
|
|
127
5
|
# repo. There is no point in linting commits that we want to vendor as
|
|
@@ -130,4 +8,4 @@ def workhorse_changes?
|
|
|
130
8
|
git.diff.any? { |file| file.path.start_with?('workhorse/') }
|
|
131
9
|
end
|
|
132
10
|
|
|
133
|
-
lint_commits(git.commits) unless workhorse_changes?
|
|
11
|
+
commit_messages.lint_commits(git.commits) unless workhorse_changes?
|
|
@@ -15,8 +15,6 @@ module Gitlab
|
|
|
15
15
|
none: None,
|
|
16
16
|
test: Test,
|
|
17
17
|
tooling: Tooling,
|
|
18
|
-
import_integrate_be: ImportIntegrateBE,
|
|
19
|
-
import_integrate_fe: ImportIntegrateFE,
|
|
20
18
|
ux: UX
|
|
21
19
|
}.freeze
|
|
22
20
|
end
|
|
@@ -60,18 +58,6 @@ module Gitlab
|
|
|
60
58
|
end
|
|
61
59
|
end
|
|
62
60
|
|
|
63
|
-
class ImportIntegrateBE < Capability
|
|
64
|
-
def has_capability?(teammate)
|
|
65
|
-
kind == :reviewer && teammate.role.match?(/Backend Engineer.+:Import and Integrate/)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
class ImportIntegrateFE < Capability
|
|
70
|
-
def has_capability?(teammate)
|
|
71
|
-
kind == :reviewer && teammate.role.match?(/Frontend Engineer.+:Import and Integrate/)
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
61
|
class UX < Capability
|
|
76
62
|
def has_capability?(teammate)
|
|
77
63
|
super && teammate.member_of_the_group?(labels)
|
|
@@ -25,8 +25,8 @@ module Gitlab
|
|
|
25
25
|
"to the commit message, and are displayed as plain text outside of GitLab",
|
|
26
26
|
message_contains_unicode_emoji: "Avoid the use of Unicode Emoji. These add no value to the commit " \
|
|
27
27
|
"message, and may not be displayed properly everywhere",
|
|
28
|
-
message_contains_short_reference: "Use full URLs instead of short references (`gitlab-org/gitlab#123
|
|
29
|
-
"`!123`), as short references are displayed as plain text outside of GitLab"
|
|
28
|
+
message_contains_short_reference: "Use full URLs instead of short references (`gitlab-org/gitlab#123`, " \
|
|
29
|
+
"`!123`, or `%12.3`), as short references are displayed as plain text outside of GitLab"
|
|
30
30
|
}
|
|
31
31
|
)
|
|
32
32
|
end
|
|
@@ -165,28 +165,6 @@ RSpec.shared_context "with teammates" do
|
|
|
165
165
|
)
|
|
166
166
|
end
|
|
167
167
|
|
|
168
|
-
let(:software_engineer_in_import_integrate_fe) do
|
|
169
|
-
Gitlab::Dangerfiles::Teammate.new(
|
|
170
|
-
"username" => "software-engineer-in-import-and-integrate-fe",
|
|
171
|
-
"name" => "Frontend Engineer in Import and Integrate",
|
|
172
|
-
"role" => "AnyRole Frontend Engineer, AnyStage:Import and Integrate",
|
|
173
|
-
"projects" => { "gitlab" => "reviewer frontend" },
|
|
174
|
-
"available" => true,
|
|
175
|
-
"tz_offset_hours" => 2.0
|
|
176
|
-
)
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
let(:software_engineer_in_import_integrate_be) do
|
|
180
|
-
Gitlab::Dangerfiles::Teammate.new(
|
|
181
|
-
"username" => "software-engineer-in-import-and-integrate-be",
|
|
182
|
-
"name" => "Backend Engineer in Import and Integrate",
|
|
183
|
-
"role" => "AnyRole Backend Engineer, AnyStage:Import and Integrate",
|
|
184
|
-
"projects" => { "gitlab" => "reviewer backend" },
|
|
185
|
-
"available" => true,
|
|
186
|
-
"tz_offset_hours" => 2.0
|
|
187
|
-
)
|
|
188
|
-
end
|
|
189
|
-
|
|
190
168
|
let(:tooling_reviewer) do
|
|
191
169
|
Gitlab::Dangerfiles::Teammate.new(
|
|
192
170
|
"username" => "eng-prod-reviewer",
|
|
@@ -220,28 +198,6 @@ RSpec.shared_context "with teammates" do
|
|
|
220
198
|
)
|
|
221
199
|
end
|
|
222
200
|
|
|
223
|
-
let(:import_and_integrate_backend_reviewer) do
|
|
224
|
-
Gitlab::Dangerfiles::Teammate.new(
|
|
225
|
-
"username" => "import-and-integrate-backend-reviewer",
|
|
226
|
-
"name" => "Import and Integrate BE engineer",
|
|
227
|
-
"role" => "AnyRole Backend Engineer, AnyStage:Import and Integrate",
|
|
228
|
-
"projects" => { "gitlab" => "reviewer backend" },
|
|
229
|
-
"available" => backend_reviewer_available,
|
|
230
|
-
"tz_offset_hours" => 2.0
|
|
231
|
-
)
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
let(:import_and_integrate_frontend_reviewer) do
|
|
235
|
-
Gitlab::Dangerfiles::Teammate.new(
|
|
236
|
-
"username" => "import-and-integrate-frontend-reviewer",
|
|
237
|
-
"name" => "Import and Integrate FE engineer",
|
|
238
|
-
"role" => "AnyRole Frontend Engineer, AnyStage:Import and Integrate",
|
|
239
|
-
"projects" => { "gitlab" => "reviewer frontend" },
|
|
240
|
-
"available" => true,
|
|
241
|
-
"tz_offset_hours" => 2.0
|
|
242
|
-
)
|
|
243
|
-
end
|
|
244
|
-
|
|
245
201
|
let(:workhorse_reviewer) do
|
|
246
202
|
Gitlab::Dangerfiles::Teammate.new(
|
|
247
203
|
"username" => "workhorse-reviewer",
|
|
@@ -276,11 +232,7 @@ RSpec.shared_context "with teammates" do
|
|
|
276
232
|
ci_template_reviewer.to_h,
|
|
277
233
|
workhorse_reviewer.to_h,
|
|
278
234
|
workhorse_maintainer.to_h,
|
|
279
|
-
analytics_instrumentation_reviewer.to_h
|
|
280
|
-
import_and_integrate_backend_reviewer.to_h,
|
|
281
|
-
import_and_integrate_frontend_reviewer.to_h,
|
|
282
|
-
software_engineer_in_import_integrate_fe.to_h,
|
|
283
|
-
software_engineer_in_import_integrate_be.to_h
|
|
235
|
+
analytics_instrumentation_reviewer.to_h
|
|
284
236
|
]
|
|
285
237
|
end
|
|
286
238
|
|
|
@@ -17,9 +17,7 @@ module Gitlab
|
|
|
17
17
|
@author = author
|
|
18
18
|
@team_author = team_author
|
|
19
19
|
@labels = labels
|
|
20
|
-
@categories = categories
|
|
21
|
-
import_and_integrate_reject_category?(project, category, labels)
|
|
22
|
-
end
|
|
20
|
+
@categories = categories
|
|
23
21
|
@random = random
|
|
24
22
|
@ux_fallback_wider_community_reviewer = ux_fallback_wider_community_reviewer
|
|
25
23
|
end
|
|
@@ -62,8 +60,6 @@ module Gitlab
|
|
|
62
60
|
# Fetch an already picked maintainer, or pick one otherwise
|
|
63
61
|
spin.maintainer = backend_spin&.maintainer || frontend_spin&.maintainer || spin_for_category(:backend).maintainer
|
|
64
62
|
end
|
|
65
|
-
when :import_integrate_be, :import_integrate_fe
|
|
66
|
-
spin.optional_role = :maintainer
|
|
67
63
|
when :ux
|
|
68
64
|
spin.optional_role = :maintainer
|
|
69
65
|
|
|
@@ -98,15 +94,6 @@ module Gitlab
|
|
|
98
94
|
|
|
99
95
|
attr_reader :random, :ux_fallback_wider_community_reviewer
|
|
100
96
|
|
|
101
|
-
# Reject Import and Integrate categories if the MR author has reviewing abilities for the category.
|
|
102
|
-
#
|
|
103
|
-
# @param [String] category name
|
|
104
|
-
# @return [Boolean]
|
|
105
|
-
def import_and_integrate_reject_category?(project, category, labels)
|
|
106
|
-
[:import_integrate_be, :import_integrate_fe].include?(category) && team_author &&
|
|
107
|
-
(team_author.reviewer?(project, category, labels) || team_author.maintainer?(project, category, labels))
|
|
108
|
-
end
|
|
109
|
-
|
|
110
97
|
# MR includes QA changes, but also other changes, and author isn't an SET
|
|
111
98
|
def author_no_qa_capability?
|
|
112
99
|
!(team_author && team_author.capabilities(project).any? { |capability| capability.end_with?("qa") })
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gitlab-dangerfiles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GitLab
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -222,6 +222,7 @@ files:
|
|
|
222
222
|
- ".rspec"
|
|
223
223
|
- ".rubocop.yml"
|
|
224
224
|
- ".rubocop_todo.yml"
|
|
225
|
+
- ".tool-versions"
|
|
225
226
|
- ".yardopts"
|
|
226
227
|
- CODE_OF_CONDUCT.md
|
|
227
228
|
- CONTRIBUTING.md
|
|
@@ -239,6 +240,7 @@ files:
|
|
|
239
240
|
- gitlab-dangerfiles.gemspec
|
|
240
241
|
- lefthook.yml
|
|
241
242
|
- lib/danger/plugins/changelog.rb
|
|
243
|
+
- lib/danger/plugins/commit_messages.rb
|
|
242
244
|
- lib/danger/plugins/duo_code.rb
|
|
243
245
|
- lib/danger/plugins/internal/helper.rb
|
|
244
246
|
- lib/danger/plugins/roulette.rb
|