gitlab-dangerfiles 4.8.1 → 4.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b42206a72b735d7a0016622666b37571d85d541a758d5454fbca3260e359f1f2
4
- data.tar.gz: ac570434fc3dee200d7656a557668454e2ceb5719c43d49b80c364688d3d0e13
3
+ metadata.gz: 053ccbe5f18fd65ff059c590e4de66d82b8632aa368453f48e5be40bba809e47
4
+ data.tar.gz: 104c829cb3c5e1113fb890885abdac06e413d7076b45f26ee406b3d6d38f1fed
5
5
  SHA512:
6
- metadata.gz: '030678a153058f6c0ab3fdb198d109ca43b8693f763a6259585b2864c7d688faec108dbbe93285226a7b926ab6f99423b6b57d703f83004b588df27917582d22'
7
- data.tar.gz: 7a3398d6bc48bdbd28a43329c311088c211b6343e00200a782b0eef9503dae39befeaaa139710847d3a674e1032508b8c938ef889f7907d9739548919fa12c97
6
+ metadata.gz: 1b0098a095fb630bb6301e2ad78c8d0709b4fdab22de3fb929a306954dd87026f4111e48f17d19d94fc7d62906f9ac413e0879d91df47c976622854b3dd63dca
7
+ data.tar.gz: 44009f0ea1dc871c36608df7ee2d3d3a28f7c92692573c54781b8fecc36e37965fed1d972004cfef2539904f07820eabf84c06bea8216b12264e36d6732a3951
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
 
13
13
  # rspec failure tracking
14
14
  .rspec_status
15
+ .idea
@@ -2,7 +2,7 @@
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-dangerfiles/-/compare/v<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
5
+ https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/-/compare/<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
6
6
 
7
7
  ## Checklist
8
8
 
data/.gitlab-ci.yml CHANGED
@@ -23,12 +23,13 @@ default:
23
23
  - vendor/ruby
24
24
 
25
25
  .default-test-job:
26
- image: "ruby:${RUBY_VERSION}"
26
+ image: "${GITLAB_DEPENDENCY_PROXY}ruby:${RUBY_VERSION}"
27
27
  stage: test
28
28
  needs: []
29
29
  before_script:
30
30
  - gem install bundler
31
- - bundle install -j $(nproc) --path vendor
31
+ - bundle config set path 'vendor'
32
+ - bundle install -j $(nproc)
32
33
  parallel:
33
34
  matrix:
34
35
  - RUBY_VERSION: ['3.0', '3.1', '3.2']
data/.rubocop.yml CHANGED
@@ -16,8 +16,17 @@ Rails:
16
16
  CodeReuse/ActiveRecord:
17
17
  Enabled: false
18
18
 
19
- Layout/LineLength:
20
- Enabled: false
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 2023-01-12 11:28:46 UTC using RuboCop version 1.36.0.
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: 3
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: 6
55
+ # Offense count: 1
64
56
  # This cop supports safe autocorrection (--autocorrect).
65
- # Configuration parameters: EnforcedStyle, IndentationWidth.
57
+ # Configuration parameters: IndentationWidth.
66
58
  # SupportedStyles: special_inside_parentheses, consistent, align_brackets
67
59
  Layout/FirstArrayElementIndentation:
68
- Exclude:
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: 3
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: 2
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: 6
172
- # This cop supports safe autocorrection (--autocorrect).
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: 24
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: 7
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: 22
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: 27
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: 33
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: 4
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: 16
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
- - 'lib/danger/rules/type_label/Dangerfile'
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 safe autocorrection (--autocorrect).
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: 1
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: 3
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: 8
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: 4
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: 4
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: 1
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: 3
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: 7
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: 2
423
+ # Offense count: 1
490
424
  # This cop supports unsafe autocorrection (--autocorrect-all).
491
425
  # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowComments.
492
- # AllowedMethods: respond_to, define_method
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: 19
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
- Style/ArrayIntersect:
524
- Exclude:
525
- - 'lib/gitlab/dangerfiles/category.rb'
526
- - 'lib/danger/plugins/changelog.rb'
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-dangerfiles (4.8.1)
4
+ gitlab-dangerfiles (4.12.0)
5
5
  danger (>= 9.3.0)
6
6
  danger-gitlab (>= 8.0.0)
7
7
  rake (~> 13.0)
@@ -117,6 +117,7 @@ GEM
117
117
  parallel (1.22.1)
118
118
  parser (3.2.1.0)
119
119
  ast (~> 2.4.1)
120
+ racc
120
121
  proc_to_ast (0.1.0)
121
122
  coderay
122
123
  parser
@@ -125,6 +126,7 @@ GEM
125
126
  coderay (~> 1.1)
126
127
  method_source (~> 1.0)
127
128
  public_suffix (5.0.1)
129
+ racc (1.8.1)
128
130
  rack (3.0.4.1)
129
131
  rainbow (3.1.1)
130
132
  rake (13.0.6)
@@ -220,6 +222,7 @@ DEPENDENCIES
220
222
  gitlab-styles (~> 10.0)
221
223
  guard-rspec (~> 4.7.3)
222
224
  lefthook (~> 1.3)
225
+ racc (~> 1.8)
223
226
  rspec (~> 3.8)
224
227
  rspec-parameterized
225
228
  rubocop-rails (< 2.21.2)
data/README.md CHANGED
@@ -171,6 +171,15 @@ This rule ensures the merge request isn't too big to be reviewed, otherwise it s
171
171
 
172
172
  This rule posts a failure if the merge request has more than 20 commits.
173
173
 
174
+ #### `danger_code_review`
175
+
176
+ This rule posts a warning/failure when `@GitLabDuo` isn't assigned as a reviewer.
177
+
178
+ ##### Available configurations
179
+
180
+ - `duo_code_review`: Whether a review from GitLab Duo Code is `:mandatory` or `:optional`.
181
+ Default to `:optional`.
182
+
174
183
  #### `metadata`
175
184
 
176
185
  This rule ensures basic metadata such as assignee, milestone and description are set on the merge request.
@@ -193,6 +202,38 @@ project. To use it in your project, perform the following steps:
193
202
  dangerfiles.import_dangerfiles(only: %w[simple_roulette])
194
203
  end
195
204
  ```
205
+
206
+ ##### Auto-assignment
207
+
208
+ By default, the simple roulette only suggests reviewers in a comment. You can, optionally, configure it to automatically assign reviewers from the roulette to your merge requests.
209
+
210
+ Configure `auto_assign_for_roulette_roles` to specify which roles to assign (`:reviewer`, `:maintainer`, or both). If empty (default), no auto-assignment occurs.
211
+
212
+ Optionally, configure `auto_assign_for_roulette_labels` to only auto-assign for Merge Requests with specific labels. If empty (default), auto-assignment applies to all MRs.
213
+
214
+ ###### Examples
215
+
216
+ ``` ruby
217
+ # Auto-assign reviewers for all MRs
218
+ helper.config.auto_assign_for_roulette_roles = [:reviewer]
219
+
220
+ # Auto-assign both reviewer and maintainer for all MRs
221
+ helper.config.auto_assign_for_roulette_roles = [:reviewer, :maintainer]
222
+
223
+ # Auto-assign reviewers only for a specific MR label
224
+ helper.config.auto_assign_for_roulette_roles = [:reviewer]
225
+ helper.config.auto_assign_for_roulette_labels = ["maintenance::dependency"]
226
+ ```
227
+
228
+ ##### Available configurations
229
+
230
+ Note: These options aren't actually used in the `simple_roulette` rule, but can be used in your own
231
+ implementation of the roulette if you use `roulette.required_approvals`/`roulette.codeowners_approvals`.
232
+
233
+ - `included_optional_codeowners_sections_for_roulette`: Indicates which optional codeowners sections
234
+ should be included in roulette. Default to `[]`.
235
+ - `excluded_required_codeowners_sections_for_roulette`: Indicates which required codeowners sections
236
+ should be excluded from roulette. Default to `[]`.
196
237
 
197
238
  #### `type_label`
198
239
 
@@ -281,6 +322,16 @@ To run the Danger Rake task in a project that doesn't have `master` as the defau
281
322
  DANGER_LOCAL_BASE="origin/main" bundle exec rake danger_local
282
323
  ```
283
324
 
325
+ ## Warnings vs Errors
326
+
327
+ The following lint violations generate warnings:
328
+
329
+ 1. The commit subject is too short ([code](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/blob/bccb167/lib/gitlab/dangerfiles/base_linter.rb#L74-76)).
330
+ 1. The commit changes too many lines across too many files without describing the changes in the commit body ([code](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/blob/bccb167/lib/gitlab/dangerfiles/commit_linter.rb#L83-85)).
331
+ 1. The commit body contains too many characters per line ([code](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/blob/bccb167/lib/gitlab/dangerfiles/commit_linter.rb#L87-96)).
332
+
333
+ All other lint violations generate errors, except when the MR has [Squash commits when merge request is accepted](https://docs.gitlab.com/ee/user/project/merge_requests/squash_and_merge.html#squash-commits-in-a-merge-request) enabled, which downgrades lint violations to warnings.
334
+
284
335
  ## Documentation
285
336
 
286
337
  Latest documentation can be found at <https://www.rubydoc.info/gems/gitlab-dangerfiles>.
@@ -307,8 +358,8 @@ For example, to test `gitlab-dangerfiles` changes from the `your-branch-name` br
307
358
 
308
359
  ```ruby
309
360
  group :development, :test, :danger do
310
- gem 'gitlab-dangerfiles', '~> 3.4.3', require: false,
311
- git: 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles.git',
361
+ gem 'gitlab-dangerfiles', require: false, feature_category: :tooling,
362
+ git: 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles.git', # rubocop:disable Cop/GemFetcher -- Testing unreleased changes
312
363
  ref: 'your-branch-name'
313
364
  end
314
365
  ```
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency "lefthook", "~> 1.3"
38
38
  spec.add_development_dependency "rspec-parameterized"
39
39
  spec.add_development_dependency "rspec", "~> 3.8"
40
+ spec.add_development_dependency "racc", "~> 1.8"
40
41
  # we do not commit the bundle lockfile, so this temporary workaround needs to be
41
42
  # present until 2.21.3 or 2.22.x is released
42
43
  # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/63
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