gitlab-dangerfiles 3.5.2 → 3.6.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: 7263e8c2ab6ba97b10b3cddc96ff91061cd526aa90992a7bd2df469b37e5e217
4
- data.tar.gz: e9b2cabb3d6819af138c2080dbca5658f404e6d7f8a71e7f51944bc32e350fde
3
+ metadata.gz: af0d569b13b09e65dfaed6f7eaf3519e314e510e71279b395eabccdb49901f83
4
+ data.tar.gz: 24050d6f8149c4e902d3c98a8b7d89aa8070a0e2445724f0f1733498d824800c
5
5
  SHA512:
6
- metadata.gz: e28612c099a81ec122a31d475880f121833741375bab94004ee647cb6ae467b074b53c07156ad4a25f361b72e9cfc54bc157b8f64ac8cc42ce4ac0b631efa229
7
- data.tar.gz: a37e350cfc9bcb13277801fa72a9a7c5a92028004e02293c34a0c69b03e3d51d6a8359480bb9a716fc5ac27f2b17ae6375dcfe239217f66eab14411949f50c0c
6
+ metadata.gz: 84d10142bb9fbf7fe03c9b4d6aee7f39cf0e9ff0ca90c167b484f3d5f1f3a13ef7aed7756c2d1b7b2873e896025ac91dc17b40b5c625d3d2cebad95f4114f3d9
7
+ data.tar.gz: 87cb02420672c5f9bb171837852733ee9550f30afc918ddb948a1e469224261eda5896ad18993b6aa550cc3d9ec5a782c1d17c278a40d3fc7a316edbf32d63c0
data/.gitlab-ci.yml CHANGED
@@ -12,7 +12,7 @@ workflow:
12
12
  - if: '$CI_COMMIT_TAG'
13
13
 
14
14
  .default:
15
- image: ruby:2.7
15
+ image: "ruby:${RUBY_VERSION}"
16
16
  tags:
17
17
  - gitlab-org
18
18
  before_script:
@@ -33,12 +33,27 @@ test:rspec:
33
33
  stage: test
34
34
  script:
35
35
  - bundle exec rspec
36
+ parallel:
37
+ matrix:
38
+ - RUBY_VERSION: ['2.7', '3.0']
39
+
40
+ test:rubocop:
41
+ extends: .default
42
+ stage: test
43
+ script:
44
+ - bundle exec rubocop -P -E .
45
+ parallel:
46
+ matrix:
47
+ - RUBY_VERSION: ['2.7', '3.0']
36
48
 
37
49
  test:rufo:
38
50
  extends: .default
39
51
  stage: test
40
52
  script:
41
53
  - bundle exec rufo --check .
54
+ parallel:
55
+ matrix:
56
+ - RUBY_VERSION: ['2.7', '3.0']
42
57
 
43
58
  include:
44
59
  - template: Security/Dependency-Scanning.gitlab-ci.yml
@@ -72,4 +87,3 @@ secret_detection:
72
87
  rules:
73
88
  - if: '$CI_MERGE_REQUEST_IID'
74
89
  - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
75
-
data/.rubocop.yml ADDED
@@ -0,0 +1,37 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ inherit_gem:
4
+ gitlab-styles:
5
+ - rubocop-default.yml
6
+
7
+ AllCops:
8
+ TargetRubyVersion: <%= RUBY_VERSION[/^\d+\.\d+/, 0] %>
9
+ NewCops: enable
10
+
11
+ # Disables Rails cops.
12
+ Rails:
13
+ Enabled: false
14
+
15
+ # Disables Rails-related cops
16
+ CodeReuse/ActiveRecord:
17
+ Enabled: false
18
+
19
+ Layout/LineLength:
20
+ Enabled: false
21
+
22
+ RSpec/MultipleMemoizedHelpers:
23
+ Max: 30
24
+
25
+ RSpec/FilePath:
26
+ Enabled: false
27
+
28
+ Style/HashSyntax:
29
+ EnforcedStyle: ruby19_no_mixed_keys
30
+
31
+ # To respect rufo formatting
32
+ Style/StringLiterals:
33
+ EnforcedStyle: double_quotes
34
+
35
+ # Was problematic, and not included in the .rubocop_todo.yml
36
+ GitlabSecurity/PublicSend:
37
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,586 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-09-23 13:42:34 UTC using RuboCop version 1.36.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Fips/MD5:
11
+ Exclude:
12
+ - 'lib/danger/plugins/roulette.rb'
13
+
14
+ # Offense count: 3
15
+ # This cop supports safe autocorrection (--autocorrect).
16
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
17
+ # Include: **/*.gemspec
18
+ Gemspec/OrderedDependencies:
19
+ Exclude:
20
+ - 'gitlab-dangerfiles.gemspec'
21
+
22
+ # Offense count: 1
23
+ # This cop supports safe autocorrection (--autocorrect).
24
+ # Configuration parameters: Include.
25
+ # Include: **/*.gemspec
26
+ Gemspec/RequireMFA:
27
+ Exclude:
28
+ - 'gitlab-dangerfiles.gemspec'
29
+
30
+ # Offense count: 1
31
+ # Configuration parameters: Include.
32
+ # Include: **/*.gemspec
33
+ Gemspec/RequiredRubyVersion:
34
+ Exclude:
35
+ - 'gitlab-dangerfiles.gemspec'
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
+ # Offense count: 6
46
+ # This cop supports safe autocorrection (--autocorrect).
47
+ Layout/ElseAlignment:
48
+ Exclude:
49
+ - 'lib/danger/plugins/changelog.rb'
50
+ - 'lib/danger/plugins/internal/helper.rb'
51
+ - 'lib/gitlab/dangerfiles/teammate.rb'
52
+
53
+ # Offense count: 6
54
+ # This cop supports safe autocorrection (--autocorrect).
55
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
56
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
57
+ Layout/EndAlignment:
58
+ Exclude:
59
+ - 'lib/danger/plugins/changelog.rb'
60
+ - 'lib/danger/plugins/internal/helper.rb'
61
+ - 'lib/gitlab/dangerfiles/teammate.rb'
62
+
63
+ # Offense count: 6
64
+ # This cop supports safe autocorrection (--autocorrect).
65
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
66
+ # SupportedStyles: special_inside_parentheses, consistent, align_brackets
67
+ Layout/FirstArrayElementIndentation:
68
+ Exclude:
69
+ - 'spec/danger/plugins/roulette_spec.rb'
70
+ - 'spec/gitlab/dangerfiles_spec.rb'
71
+
72
+ # Offense count: 6
73
+ # This cop supports safe autocorrection (--autocorrect).
74
+ # Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
75
+ Layout/IndentationWidth:
76
+ Exclude:
77
+ - 'lib/danger/plugins/changelog.rb'
78
+ - 'lib/danger/plugins/internal/helper.rb'
79
+ - 'lib/gitlab/dangerfiles/teammate.rb'
80
+
81
+ # Offense count: 4
82
+ # This cop supports safe autocorrection (--autocorrect).
83
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
84
+ # SupportedStyles: aligned, indented
85
+ Layout/LineEndStringConcatenationIndentation:
86
+ Exclude:
87
+ - 'lib/gitlab/dangerfiles/commit_linter.rb'
88
+
89
+ # Offense count: 7
90
+ # This cop supports safe autocorrection (--autocorrect).
91
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
92
+ # SupportedStyles: aligned, indented
93
+ Layout/MultilineOperationIndentation:
94
+ Exclude:
95
+ - 'lib/danger/plugins/changelog.rb'
96
+ - 'lib/gitlab/dangerfiles/commit_linter.rb'
97
+ - 'lib/gitlab/dangerfiles/emoji_checker.rb'
98
+ - 'lib/gitlab/dangerfiles/teammate.rb'
99
+ - 'spec/danger/plugins/roulette_spec.rb'
100
+
101
+ # Offense count: 1
102
+ # This cop supports safe autocorrection (--autocorrect).
103
+ Layout/RescueEnsureAlignment:
104
+ Exclude:
105
+ - 'lib/danger/plugins/roulette.rb'
106
+
107
+ # Offense count: 11
108
+ # This cop supports safe autocorrection (--autocorrect).
109
+ Lint/AmbiguousOperatorPrecedence:
110
+ Exclude:
111
+ - 'lib/gitlab/dangerfiles/teammate.rb'
112
+ - 'spec/gitlab/dangerfiles/base_linter_spec.rb'
113
+ - 'spec/gitlab/dangerfiles/commit_linter_spec.rb'
114
+ - 'spec/gitlab/dangerfiles/weightage/reviewers_spec.rb'
115
+ - 'spec/gitlab/merge_request_linter_spec.rb'
116
+
117
+ # Offense count: 1
118
+ Lint/BinaryOperatorWithIdenticalOperands:
119
+ Exclude:
120
+ - 'spec/gitlab/dangerfiles/teammate_spec.rb'
121
+
122
+ # Offense count: 2
123
+ # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
124
+ Lint/DuplicateBranch:
125
+ Exclude:
126
+ - 'lib/danger/plugins/roulette.rb'
127
+
128
+ # Offense count: 2
129
+ # This cop supports safe autocorrection (--autocorrect).
130
+ Lint/DuplicateRegexpCharacterClassElement:
131
+ Exclude:
132
+ - 'spec/danger/plugins/internal/helper_spec.rb'
133
+
134
+ # Offense count: 8
135
+ # This cop supports safe autocorrection (--autocorrect).
136
+ Lint/IdentityComparison:
137
+ Exclude:
138
+ - 'spec/gitlab/dangerfiles/weightage/maintainers_spec.rb'
139
+ - 'spec/gitlab/dangerfiles/weightage/reviewers_spec.rb'
140
+
141
+ # Offense count: 1
142
+ Lint/NonLocalExitFromIterator:
143
+ Exclude:
144
+ - 'lib/danger/rules/subtype_label/Dangerfile'
145
+
146
+ # Offense count: 1
147
+ # This cop supports safe autocorrection (--autocorrect).
148
+ Lint/RedundantCopDisableDirective:
149
+ Exclude:
150
+ - 'lib/gitlab/dangerfiles/spec_helper.rb'
151
+
152
+ # Offense count: 5
153
+ # This cop supports unsafe autocorrection (--autocorrect-all).
154
+ Lint/RedundantDirGlobSort:
155
+ Exclude:
156
+ - 'lib/gitlab/dangerfiles.rb'
157
+ - 'spec/gitlab/dangerfiles_spec.rb'
158
+ - 'spec/spec_helper.rb'
159
+
160
+ # Offense count: 1
161
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
162
+ Metrics/AbcSize:
163
+ Max: 67
164
+
165
+ # Offense count: 1
166
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
167
+ Metrics/CyclomaticComplexity:
168
+ Max: 31
169
+
170
+ # Offense count: 1
171
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
172
+ Metrics/PerceivedComplexity:
173
+ Max: 26
174
+
175
+ # Offense count: 1
176
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
177
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
178
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
179
+ Naming/FileName:
180
+ Exclude:
181
+ - 'lib/gitlab-dangerfiles.rb'
182
+
183
+ # Offense count: 3
184
+ # This cop supports safe autocorrection (--autocorrect).
185
+ # Configuration parameters: PreferredName.
186
+ Naming/RescuedExceptionsVariableName:
187
+ Exclude:
188
+ - 'lib/danger/plugins/changelog.rb'
189
+ - 'lib/danger/plugins/roulette.rb'
190
+
191
+ # Offense count: 2
192
+ # Configuration parameters: MinSize.
193
+ Performance/CollectionLiteralInLoop:
194
+ Exclude:
195
+ - 'spec/danger/plugins/roulette_spec.rb'
196
+
197
+ # Offense count: 5
198
+ Performance/MethodObjectAsBlock:
199
+ Exclude:
200
+ - 'lib/danger/plugins/roulette.rb'
201
+ - 'spec/spec_helper.rb'
202
+
203
+ # Offense count: 6
204
+ # This cop supports safe autocorrection (--autocorrect).
205
+ RSpec/BeEq:
206
+ Exclude:
207
+ - 'spec/danger/plugins/changelog_spec.rb'
208
+ - 'spec/gitlab/dangerfiles/changes_spec.rb'
209
+ - 'spec/gitlab/dangerfiles/teammate_spec.rb'
210
+
211
+ # Offense count: 1
212
+ # This cop supports safe autocorrection (--autocorrect).
213
+ # Configuration parameters: EnforcedStyle.
214
+ # SupportedStyles: be, be_nil
215
+ RSpec/BeNil:
216
+ Exclude:
217
+ - 'spec/gitlab/dangerfiles/version_spec.rb'
218
+
219
+ # Offense count: 24
220
+ # Configuration parameters: Prefixes, AllowedPatterns.
221
+ # Prefixes: when, with, without
222
+ RSpec/ContextWording:
223
+ Exclude:
224
+ - 'spec/danger/plugins/changelog_spec.rb'
225
+ - 'spec/danger/plugins/internal/helper_spec.rb'
226
+ - 'spec/danger/plugins/roulette_spec.rb'
227
+
228
+ # Offense count: 1
229
+ # This cop supports safe autocorrection (--autocorrect).
230
+ # Configuration parameters: AllowConsecutiveOneLiners.
231
+ RSpec/EmptyLineAfterExample:
232
+ Exclude:
233
+ - 'spec/danger/plugins/internal/helper_spec.rb'
234
+
235
+ # Offense count: 1
236
+ # This cop supports safe autocorrection (--autocorrect).
237
+ RSpec/EmptyLineAfterLetBlock:
238
+ Exclude:
239
+ - 'spec/danger/plugins/internal/helper_spec.rb'
240
+
241
+ # Offense count: 3
242
+ RSpec/ExpectInHook:
243
+ Exclude:
244
+ - 'spec/danger/plugins/internal/helper_spec.rb'
245
+
246
+ # Offense count: 2
247
+ # This cop supports safe autocorrection (--autocorrect).
248
+ RSpec/HooksBeforeExamples:
249
+ Exclude:
250
+ - 'spec/danger/plugins/changelog_spec.rb'
251
+ - 'spec/danger/plugins/roulette_spec.rb'
252
+
253
+ # Offense count: 22
254
+ # This cop supports safe autocorrection (--autocorrect).
255
+ # Configuration parameters: EnforcedStyle.
256
+ # SupportedStyles: single_line_only, single_statement_only, disallow
257
+ RSpec/ImplicitSubject:
258
+ Exclude:
259
+ - 'spec/danger/plugins/changelog_spec.rb'
260
+ - 'spec/danger/plugins/internal/helper_spec.rb'
261
+ - 'spec/danger/plugins/roulette_spec.rb'
262
+
263
+ # Offense count: 27
264
+ # This cop supports safe autocorrection (--autocorrect).
265
+ RSpec/LetBeforeExamples:
266
+ Exclude:
267
+ - 'spec/danger/plugins/internal/helper_spec.rb'
268
+ - 'spec/danger/plugins/roulette_spec.rb'
269
+
270
+ # Offense count: 47
271
+ # This cop supports unsafe autocorrection (--autocorrect-all).
272
+ # Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
273
+ # SupportedStyles: inflected, explicit
274
+ RSpec/PredicateMatcher:
275
+ Exclude:
276
+ - 'spec/danger/plugins/changelog_spec.rb'
277
+ - 'spec/danger/plugins/internal/helper_spec.rb'
278
+ - 'spec/gitlab/dangerfiles/teammate_spec.rb'
279
+
280
+ # Offense count: 2
281
+ RSpec/RepeatedExampleGroupDescription:
282
+ Exclude:
283
+ - 'spec/gitlab/dangerfiles/commit_linter_spec.rb'
284
+
285
+ # Offense count: 31
286
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
287
+ RSpec/VerifiedDoubles:
288
+ Exclude:
289
+ - 'spec/danger/plugins/changelog_spec.rb'
290
+ - 'spec/danger/plugins/internal/helper_spec.rb'
291
+ - 'spec/gitlab/dangerfiles/commit_linter_spec.rb'
292
+ - 'spec/gitlab/dangerfiles/weightage/maintainers_spec.rb'
293
+ - 'spec/gitlab/dangerfiles/weightage/reviewers_spec.rb'
294
+ - 'spec/gitlab/dangerfiles_spec.rb'
295
+
296
+ # Offense count: 3
297
+ # This cop supports safe autocorrection (--autocorrect).
298
+ # Configuration parameters: EnforcedStyle.
299
+ # SupportedStyles: percent_q, bare_percent
300
+ Style/BarePercentLiterals:
301
+ Exclude:
302
+ - 'lib/danger/plugins/internal/helper.rb'
303
+ - 'spec/danger/plugins/internal/helper_spec.rb'
304
+
305
+ # Offense count: 1
306
+ # This cop supports safe autocorrection (--autocorrect).
307
+ Style/ExpandPathArguments:
308
+ Exclude:
309
+ - 'gitlab-dangerfiles.gemspec'
310
+
311
+ # Offense count: 4
312
+ # This cop supports safe autocorrection (--autocorrect).
313
+ # Configuration parameters: AllowedVars.
314
+ Style/FetchEnvVar:
315
+ Exclude:
316
+ - 'lib/danger/rules/commit_messages/Dangerfile'
317
+ - 'lib/danger/rules/z_retry_link/Dangerfile'
318
+ - 'lib/gitlab/dangerfiles/config.rb'
319
+
320
+ # Offense count: 3
321
+ # This cop supports safe autocorrection (--autocorrect).
322
+ # Configuration parameters: EnforcedStyle.
323
+ # SupportedStyles: format, sprintf, percent
324
+ Style/FormatString:
325
+ Exclude:
326
+ - 'lib/danger/rules/simple_roulette/Dangerfile'
327
+ - 'lib/gitlab/dangerfiles/base_linter.rb'
328
+
329
+ # Offense count: 16
330
+ # This cop supports unsafe autocorrection (--autocorrect-all).
331
+ # Configuration parameters: EnforcedStyle.
332
+ # SupportedStyles: always, always_true, never
333
+ Style/FrozenStringLiteralComment:
334
+ Enabled: false
335
+
336
+ # Offense count: 2
337
+ # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
338
+ Style/GuardClause:
339
+ Exclude:
340
+ - 'lib/danger/rules/subtype_label/Dangerfile'
341
+ - 'lib/danger/rules/type_label/Dangerfile'
342
+
343
+ # Offense count: 2
344
+ # This cop supports safe autocorrection (--autocorrect).
345
+ Style/HashExcept:
346
+ Exclude:
347
+ - 'lib/gitlab/dangerfiles.rb'
348
+
349
+ # Offense count: 1
350
+ # This cop supports safe autocorrection (--autocorrect).
351
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
352
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
353
+ # SupportedShorthandSyntax: always, never, either, consistent
354
+ Style/HashSyntax:
355
+ Exclude:
356
+ - 'Rakefile'
357
+
358
+ # Offense count: 1
359
+ # This cop supports safe autocorrection (--autocorrect).
360
+ # Configuration parameters: AllowIfModifier.
361
+ Style/IfInsideElse:
362
+ Exclude:
363
+ - 'lib/danger/rules/commit_messages/Dangerfile'
364
+
365
+ # Offense count: 23
366
+ # This cop supports safe autocorrection (--autocorrect).
367
+ Style/IfUnlessModifier:
368
+ Exclude:
369
+ - 'lib/danger/plugins/changelog.rb'
370
+ - 'lib/danger/plugins/roulette.rb'
371
+ - 'lib/danger/rules/commit_messages/Dangerfile'
372
+ - 'lib/danger/rules/commits_counter/Dangerfile'
373
+ - 'lib/danger/rules/simple_roulette/Dangerfile'
374
+ - 'lib/danger/rules/z_retry_link/Dangerfile'
375
+ - 'lib/gitlab/dangerfiles.rb'
376
+ - 'lib/gitlab/dangerfiles/base_linter.rb'
377
+ - 'lib/gitlab/dangerfiles/commit_linter.rb'
378
+
379
+ # Offense count: 3
380
+ # This cop supports unsafe autocorrection (--autocorrect-all).
381
+ # Configuration parameters: EnforcedStyle.
382
+ # SupportedStyles: literals, strict
383
+ Style/MutableConstant:
384
+ Exclude:
385
+ - 'lib/danger/rules/commit_messages/Dangerfile'
386
+ - 'lib/danger/rules/simple_roulette/Dangerfile'
387
+ - 'lib/gitlab/dangerfiles/version.rb'
388
+
389
+ # Offense count: 1
390
+ # This cop supports safe autocorrection (--autocorrect).
391
+ # Configuration parameters: EnforcedOctalStyle.
392
+ # SupportedOctalStyles: zero_with_o, zero_only
393
+ Style/NumericLiteralPrefix:
394
+ Exclude:
395
+ - 'spec/danger/plugins/roulette_spec.rb'
396
+
397
+ # Offense count: 3
398
+ # This cop supports unsafe autocorrection (--autocorrect-all).
399
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
400
+ # SupportedStyles: predicate, comparison
401
+ Style/NumericPredicate:
402
+ Exclude:
403
+ - 'lib/danger/plugins/roulette.rb'
404
+ - 'lib/gitlab/dangerfiles/teammate.rb'
405
+
406
+ # Offense count: 1
407
+ Style/OptionalArguments:
408
+ Exclude:
409
+ - 'lib/danger/rules/simple_roulette/Dangerfile'
410
+
411
+ # Offense count: 8
412
+ # This cop supports safe autocorrection (--autocorrect).
413
+ # Configuration parameters: PreferredDelimiters.
414
+ Style/PercentLiteralDelimiters:
415
+ Exclude:
416
+ - 'Guardfile'
417
+ - 'gitlab-dangerfiles.gemspec'
418
+ - 'lib/danger/plugins/internal/helper.rb'
419
+ - 'lib/danger/rules/subtype_label/Dangerfile'
420
+ - 'lib/gitlab/dangerfiles/tasks/main.rake'
421
+ - 'spec/danger/plugins/internal/helper_spec.rb'
422
+
423
+ # Offense count: 2
424
+ # This cop supports safe autocorrection (--autocorrect).
425
+ # Configuration parameters: .
426
+ # SupportedStyles: same_as_string_literals, single_quotes, double_quotes
427
+ Style/QuotedSymbols:
428
+ EnforcedStyle: double_quotes
429
+
430
+ # Offense count: 1
431
+ # This cop supports unsafe autocorrection (--autocorrect-all).
432
+ # Configuration parameters: Methods.
433
+ Style/RedundantArgument:
434
+ Exclude:
435
+ - 'lib/gitlab/dangerfiles/base_linter.rb'
436
+
437
+ # Offense count: 12
438
+ # This cop supports safe autocorrection (--autocorrect).
439
+ Style/RedundantFreeze:
440
+ Exclude:
441
+ - 'lib/danger/plugins/changelog.rb'
442
+ - 'lib/danger/plugins/roulette.rb'
443
+ - 'lib/gitlab/dangerfiles/commit_linter.rb'
444
+ - 'lib/gitlab/dangerfiles/emoji_checker.rb'
445
+ - 'lib/gitlab/dangerfiles/title_linting.rb'
446
+
447
+ # Offense count: 1
448
+ # This cop supports unsafe autocorrection (--autocorrect-all).
449
+ Style/RedundantInterpolation:
450
+ Exclude:
451
+ - 'lib/gitlab/dangerfiles/teammate.rb'
452
+
453
+ # Offense count: 4
454
+ # This cop supports safe autocorrection (--autocorrect).
455
+ Style/RedundantRegexpEscape:
456
+ Exclude:
457
+ - 'lib/gitlab/dangerfiles/commit_linter.rb'
458
+ - 'lib/gitlab/dangerfiles/emoji_checker.rb'
459
+ - 'lib/gitlab/dangerfiles/title_linting.rb'
460
+
461
+ # Offense count: 1
462
+ # This cop supports safe autocorrection (--autocorrect).
463
+ Style/RedundantSelf:
464
+ Exclude:
465
+ - 'lib/danger/rules/commit_messages/Dangerfile'
466
+
467
+ # Offense count: 2
468
+ # This cop supports safe autocorrection (--autocorrect).
469
+ # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
470
+ # SupportedStyles: slashes, percent_r, mixed
471
+ Style/RegexpLiteral:
472
+ Exclude:
473
+ - 'lib/danger/plugins/internal/helper.rb'
474
+ - 'lib/gitlab/dangerfiles/emoji_checker.rb'
475
+
476
+ # Offense count: 2
477
+ # This cop supports safe autocorrection (--autocorrect).
478
+ Style/RescueModifier:
479
+ Exclude:
480
+ - 'lib/gitlab/dangerfiles/commit_linter.rb'
481
+
482
+ # Offense count: 3
483
+ # This cop supports safe autocorrection (--autocorrect).
484
+ # Configuration parameters: EnforcedStyle.
485
+ # SupportedStyles: implicit, explicit
486
+ Style/RescueStandardError:
487
+ Exclude:
488
+ - 'lib/danger/plugins/changelog.rb'
489
+ - 'lib/danger/plugins/internal/helper.rb'
490
+ - 'lib/danger/plugins/roulette.rb'
491
+
492
+ # Offense count: 1
493
+ # This cop supports unsafe autocorrection (--autocorrect-all).
494
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
495
+ # AllowedMethods: present?, blank?, presence, try, try!
496
+ Style/SafeNavigation:
497
+ Exclude:
498
+ - 'lib/danger/rules/commit_messages/Dangerfile'
499
+
500
+ # Offense count: 1
501
+ # This cop supports unsafe autocorrection (--autocorrect-all).
502
+ Style/SelectByRegexp:
503
+ Exclude:
504
+ - 'lib/danger/plugins/internal/helper.rb'
505
+
506
+ # Offense count: 2
507
+ # This cop supports safe autocorrection (--autocorrect).
508
+ # Configuration parameters: EnforcedStyle.
509
+ # SupportedStyles: only_raise, only_fail, semantic
510
+ Style/SignalException:
511
+ Exclude:
512
+ - 'lib/danger/rules/subtype_label/Dangerfile'
513
+ - 'lib/danger/rules/type_label/Dangerfile'
514
+
515
+ # Offense count: 7
516
+ # This cop supports unsafe autocorrection (--autocorrect-all).
517
+ # Configuration parameters: Mode.
518
+ Style/StringConcatenation:
519
+ Exclude:
520
+ - 'spec/gitlab/dangerfiles/base_linter_spec.rb'
521
+ - 'spec/gitlab/dangerfiles/commit_linter_spec.rb'
522
+ - 'spec/gitlab/merge_request_linter_spec.rb'
523
+
524
+ # Offense count: 6
525
+ # This cop supports safe autocorrection (--autocorrect).
526
+ # Configuration parameters: EnforcedStyle.
527
+ # SupportedStyles: single_quotes, double_quotes
528
+ Style/StringLiteralsInInterpolation:
529
+ Exclude:
530
+ - 'lib/danger/plugins/internal/helper.rb'
531
+ - 'lib/danger/plugins/roulette.rb'
532
+ - 'lib/danger/rules/commit_messages/Dangerfile'
533
+ - 'spec/gitlab/dangerfiles/teammate_spec.rb'
534
+
535
+ # Offense count: 2
536
+ # This cop supports unsafe autocorrection (--autocorrect-all).
537
+ # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowComments.
538
+ # AllowedMethods: respond_to, define_method
539
+ Style/SymbolProc:
540
+ Exclude:
541
+ - 'lib/danger/rules/commit_messages/Dangerfile'
542
+ - 'spec/gitlab/dangerfiles_spec.rb'
543
+
544
+ # Offense count: 19
545
+ # This cop supports safe autocorrection (--autocorrect).
546
+ # Configuration parameters: EnforcedStyleForMultiline.
547
+ # SupportedStylesForMultiline: comma, consistent_comma, no_comma
548
+ Style/TrailingCommaInArguments:
549
+ Exclude:
550
+ - 'spec/danger/plugins/roulette_spec.rb'
551
+
552
+ # Offense count: 18
553
+ # This cop supports safe autocorrection (--autocorrect).
554
+ # Configuration parameters: EnforcedStyleForMultiline.
555
+ # SupportedStylesForMultiline: comma, consistent_comma, no_comma
556
+ Style/TrailingCommaInArrayLiteral:
557
+ Exclude:
558
+ - 'lib/danger/plugins/changelog.rb'
559
+ - 'lib/gitlab/dangerfiles/merge_request_linter.rb'
560
+ - 'spec/danger/plugins/changelog_spec.rb'
561
+ - 'spec/danger/plugins/internal/helper_spec.rb'
562
+ - 'spec/danger/plugins/roulette_spec.rb'
563
+ - 'spec/gitlab/dangerfiles/base_linter_spec.rb'
564
+ - 'spec/gitlab/dangerfiles/commit_linter_spec.rb'
565
+ - 'spec/gitlab/dangerfiles/title_linting_spec.rb'
566
+ - 'spec/gitlab/dangerfiles/weightage/maintainers_spec.rb'
567
+ - 'spec/gitlab/dangerfiles/weightage/reviewers_spec.rb'
568
+
569
+ # Offense count: 29
570
+ # This cop supports safe autocorrection (--autocorrect).
571
+ # Configuration parameters: EnforcedStyleForMultiline.
572
+ # SupportedStylesForMultiline: comma, consistent_comma, no_comma
573
+ Style/TrailingCommaInHashLiteral:
574
+ Exclude:
575
+ - 'lib/danger/plugins/changelog.rb'
576
+ - 'lib/danger/plugins/internal/helper.rb'
577
+ - 'lib/danger/plugins/roulette.rb'
578
+ - 'lib/gitlab/dangerfiles/base_linter.rb'
579
+ - 'lib/gitlab/dangerfiles/commit_linter.rb'
580
+ - 'lib/gitlab/dangerfiles/spec_helper.rb'
581
+ - 'lib/gitlab/dangerfiles/type_label_guesser.rb'
582
+ - 'spec/danger/plugins/internal/helper_spec.rb'
583
+ - 'spec/danger/plugins/roulette_spec.rb'
584
+ - 'spec/gitlab/dangerfiles/config_spec.rb'
585
+ - 'spec/gitlab/dangerfiles/teammate_spec.rb'
586
+ - 'spec/gitlab/dangerfiles_spec.rb'
data/Gemfile CHANGED
@@ -11,6 +11,10 @@ group :development do
11
11
  gem "lefthook", require: false
12
12
  end
13
13
 
14
+ group :development, :test do
15
+ gem "gitlab-styles", "~> 9.0.0", require: false
16
+ end
17
+
14
18
  group :test do
15
19
  gem "pry-byebug", "~> 3.8", require: false
16
20
  end
data/README.md CHANGED
@@ -94,6 +94,7 @@ Alternatively, you can also get/set configuration on the engine directly via `Gi
94
94
  - `files_to_category`: A hash of the form `{ filename_regex => categories, [filename_regex, changes_regex] => categories }`.
95
95
  `filename_regex` is the regex pattern to match file names. `changes_regex` is the regex pattern to
96
96
  match changed lines in files that match `filename_regex`. Used in `helper.changes_by_category`, `helper.changes`, and `helper.categories_for_file`.
97
+ - `disabled_roulette_categories`: A list of categories that roulette can be disabled. In the projects where specific review workflows are not ready, this can be used to disable them.
97
98
 
98
99
  ### Rules
99
100
 
data/lefthook.yml CHANGED
@@ -1,11 +1,19 @@
1
- # EXAMPLE USAGE
2
- # Refer for explanation to following link:
3
- # https://github.com/evilmartians/lefthook/blob/master/docs/full_guide.md
4
- #
1
+ # Lefthook configuration. For more information, see:
2
+ # https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
5
3
 
6
4
  pre-push:
7
5
  commands:
8
- # Runs RUby FOrmatter (rufo)
6
+ # Run all tests (warn if there are any missing tools required for tests).
7
+ rspec:
8
+ run: bundle exec rspec -f progress
9
+ glob: '*.rb'
10
+
11
+ # Run ruby linting
12
+ rubocop:
13
+ run: bundle exec rubocop
14
+ glob: '*.rb'
15
+
16
+ # Ruby formatting checks
9
17
  rufo:
10
18
  run: bundle exec rufo --check .
11
19
  glob: '*.rb'
@@ -171,7 +171,7 @@ module Danger
171
171
 
172
172
  def spin_role_for_category(team, role, project, category)
173
173
  team.select do |member|
174
- member.public_send("#{role}?", project, category, helper.mr_labels) # rubocop:disable GitlabSecurity/PublicSend
174
+ member.public_send("#{role}?", project, category, helper.mr_labels)
175
175
  end
176
176
  end
177
177
 
@@ -121,7 +121,7 @@ def warn_or_fail_commits(failed_linters, default_to_fail: true)
121
121
  when :subject_too_short, :subject_above_warning, :details_too_many_changes, :details_line_too_long
122
122
  warn_commit(linter.commit, problem_desc)
123
123
  else
124
- self.__send__("#{level}_commit", linter.commit, problem_desc) # rubocop:disable GitlabSecurity/PublicSend
124
+ self.__send__("#{level}_commit", linter.commit, problem_desc)
125
125
  end
126
126
  end
127
127
  end
@@ -87,6 +87,9 @@ categories << :product_intelligence if helper.mr_labels.include?("product intell
87
87
  # Skip Product intelligence reviews for growth experiment MRs
88
88
  categories.delete(:product_intelligence) if helper.mr_labels.include?("growth experiment")
89
89
 
90
+ # Remove disabled categories
91
+ categories.subtract(helper.config.disabled_roulette_categories)
92
+
90
93
  if changes.any?
91
94
  has_categories = categories.any?
92
95
  categories = [nil] unless has_categories
@@ -29,6 +29,10 @@ module Gitlab
29
29
  # @return [Integer] the maximum number of allowed non-squashed/non-fixup commits for a given MR. A warning is triggered if the MR has more commits.
30
30
  attr_accessor :max_commits_count
31
31
 
32
+ # @!attribute disabled_roulette_categories
33
+ # @return [Array] indicating which categories would be disabled for the simple roulette. Default to `[]` (all categories are enabled)
34
+ attr_accessor :disabled_roulette_categories
35
+
32
36
  DEFAULT_CHANGES_SIZE_THRESHOLDS = { high: 2_000, medium: 500 }.freeze
33
37
  DEFAULT_COMMIT_MESSAGES_MAX_COMMITS_COUNT = 10
34
38
 
@@ -39,6 +43,7 @@ module Gitlab
39
43
  @ci_only_rules = []
40
44
  @code_size_thresholds = DEFAULT_CHANGES_SIZE_THRESHOLDS
41
45
  @max_commits_count = DEFAULT_COMMIT_MESSAGES_MAX_COMMITS_COUNT
46
+ @disabled_roulette_categories = []
42
47
  end
43
48
  end
44
49
  end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "3.5.2"
3
+ VERSION = "3.6.0"
4
4
  end
5
5
  end
@@ -7,6 +7,7 @@ module Gitlab
7
7
  CI_ONLY_RULES = %w[
8
8
  simple_roulette
9
9
  type_label
10
+ subtype_label
10
11
  z_add_labels
11
12
  z_retry_link
12
13
  ].freeze
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: 3.5.2
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-08 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -150,6 +150,8 @@ files:
150
150
  - ".gitlab/merge_request_templates/Release.md"
151
151
  - ".gitpod.yml"
152
152
  - ".rspec"
153
+ - ".rubocop.yml"
154
+ - ".rubocop_todo.yml"
153
155
  - ".yardopts"
154
156
  - CODE_OF_CONDUCT.md
155
157
  - CONTRIBUTING.md