gitlab-styles 4.1.0 → 5.2.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/.editorconfig +18 -0
- data/.gitlab-ci.yml +4 -15
- data/.gitlab/merge_request_templates/New Static Analysis Check.md +21 -0
- data/.gitlab/merge_request_templates/Release.md +4 -4
- data/.rubocop.yml +3 -1
- data/Gemfile +2 -2
- data/gitlab-styles.gemspec +5 -4
- data/lib/gitlab/styles/rubocop.rb +5 -0
- data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/code_reuse/active_record.rb +131 -0
- data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +6 -3
- data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb +132 -0
- data/lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/rspec/base.rb +18 -0
- data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb +65 -0
- data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb +65 -0
- data/lib/gitlab/styles/rubocop/cop/rspec/example_starting_character.rb +124 -0
- data/lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb +10 -5
- data/lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb +3 -2
- data/lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb +10 -13
- data/lib/gitlab/styles/rubocop/model_helpers.rb +1 -1
- data/lib/gitlab/styles/rubocop/rspec/helpers.rb +17 -0
- data/lib/gitlab/styles/version.rb +1 -1
- data/rubocop-all.yml +1 -0
- data/rubocop-bundler.yml +1 -0
- data/rubocop-code_reuse.yml +24 -0
- data/rubocop-default.yml +1 -0
- data/rubocop-gemspec.yml +1 -0
- data/rubocop-layout.yml +6 -0
- data/rubocop-lint.yml +63 -5
- data/rubocop-metrics.yml +1 -0
- data/rubocop-migrations.yml +1 -0
- data/rubocop-naming.yml +1 -0
- data/rubocop-performance.yml +48 -0
- data/rubocop-rails.yml +79 -0
- data/rubocop-rspec.yml +14 -0
- data/rubocop-security.yml +1 -0
- data/rubocop-style.yml +90 -1
- metadata +22 -13
- data/.rubocop_todo.yml +0 -7
data/rubocop-style.yml
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
---
|
2
|
+
# Checks for grouping of accessors in class and module bodies.
|
3
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleaccessorgrouping
|
4
|
+
Style/AccessorGrouping:
|
5
|
+
Enabled: true
|
6
|
+
|
1
7
|
# Use alias_method instead of alias.
|
2
8
|
Style/Alias:
|
3
9
|
EnforcedStyle: prefer_alias_method
|
@@ -8,6 +14,11 @@ Style/Alias:
|
|
8
14
|
Style/AndOr:
|
9
15
|
Enabled: true
|
10
16
|
|
17
|
+
# Enforces the use of Array() instead of explicit Array check or [*var]
|
18
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylearraycoercion
|
19
|
+
Style/ArrayCoercion:
|
20
|
+
Enabled: true
|
21
|
+
|
11
22
|
# Use `Array#join` instead of `Array#*`.
|
12
23
|
Style/ArrayJoin:
|
13
24
|
Enabled: true
|
@@ -24,6 +35,11 @@ Style/Attr:
|
|
24
35
|
Style/BeginBlock:
|
25
36
|
Enabled: true
|
26
37
|
|
38
|
+
# Checks for places where attr_reader and attr_writer for the same method can be combined into single attr_accessor.
|
39
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylebisectedattraccessor
|
40
|
+
Style/BisectedAttrAccessor:
|
41
|
+
Enabled: true
|
42
|
+
|
27
43
|
# Do not use block comments.
|
28
44
|
Style/BlockComments:
|
29
45
|
Enabled: true
|
@@ -33,10 +49,15 @@ Style/BlockComments:
|
|
33
49
|
Style/BlockDelimiters:
|
34
50
|
Enabled: true
|
35
51
|
|
36
|
-
#
|
52
|
+
# Checks for uses of the case equality operator(===).
|
37
53
|
Style/CaseEquality:
|
38
54
|
Enabled: false
|
39
55
|
|
56
|
+
# Identifies places where if-elsif constructions can be replaced with case-when.
|
57
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylecaselikeif
|
58
|
+
Style/CaseLikeIf:
|
59
|
+
Enabled: true
|
60
|
+
|
40
61
|
# Checks for uses of character literals.
|
41
62
|
Style/CharacterLiteral:
|
42
63
|
Enabled: true
|
@@ -95,6 +116,12 @@ Style/EndBlock:
|
|
95
116
|
Style/EvenOdd:
|
96
117
|
Enabled: true
|
97
118
|
|
119
|
+
# Enforces the use of explicit block argument to avoid writing block literal that
|
120
|
+
# just passes its arguments to another block.
|
121
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleexplicitblockargument
|
122
|
+
Style/ExplicitBlockArgument:
|
123
|
+
Enabled: true
|
124
|
+
|
98
125
|
# Enforces consistency when using exponential notation for numbers in the code
|
99
126
|
Style/ExponentialNotation:
|
100
127
|
Enabled: true
|
@@ -111,6 +138,13 @@ Style/FormatStringToken:
|
|
111
138
|
Style/FrozenStringLiteralComment:
|
112
139
|
Enabled: true
|
113
140
|
|
141
|
+
# Enforces the use of $stdout/$stderr/$stdin instead of STDOUT/STDERR/STDIN. STDOUT/STDERR/STDIN are constants,
|
142
|
+
# and while you can actually reassign (possibly to redirect some stream) constants in Ruby,
|
143
|
+
# you’ll get an interpreter warning if you do so.
|
144
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleglobalstdstream
|
145
|
+
Style/GlobalStdStream:
|
146
|
+
Enabled: true
|
147
|
+
|
114
148
|
# Do not introduce global variables.
|
115
149
|
Style/GlobalVars:
|
116
150
|
Enabled: true
|
@@ -118,10 +152,20 @@ Style/GlobalVars:
|
|
118
152
|
- 'lib/backup/**/*'
|
119
153
|
- 'lib/tasks/**/*'
|
120
154
|
|
155
|
+
# Checks for presence or absence of braces around hash literal as a last array item depending on configuration.
|
156
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylehashaslastarrayitem
|
157
|
+
Style/HashAsLastArrayItem:
|
158
|
+
Enabled: true
|
159
|
+
|
121
160
|
# Checks for uses of each_key and each_value Hash methods.
|
122
161
|
Style/HashEachMethods:
|
123
162
|
Enabled: true
|
124
163
|
|
164
|
+
# Checks for places where case-when represents a simple 1:1 mapping and can be replaced with a hash lookup.
|
165
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylehashlikecase
|
166
|
+
Style/HashLikeCase:
|
167
|
+
Enabled: false
|
168
|
+
|
125
169
|
# Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
|
126
170
|
# over 1.8 syntax `{ :a => 1, :b => 2 }`.
|
127
171
|
Style/HashSyntax:
|
@@ -161,6 +205,11 @@ Style/InverseMethods:
|
|
161
205
|
Style/LambdaCall:
|
162
206
|
Enabled: true
|
163
207
|
|
208
|
+
# Checks for places where keyword arguments can be used instead of boolean arguments when defining methods.
|
209
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleoptionalbooleanparameter
|
210
|
+
Style/OptionalBooleanParameter:
|
211
|
+
Enabled: false
|
212
|
+
|
164
213
|
# Use `strip` instead of `lstrip.rstrip`.
|
165
214
|
Style/Strip:
|
166
215
|
Enabled: true
|
@@ -248,10 +297,25 @@ Style/PreferredHashMethods:
|
|
248
297
|
Style/RedundantCapitalW:
|
249
298
|
Enabled: true
|
250
299
|
|
300
|
+
# Checks for redundant assignment before returning.
|
301
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantassignment
|
302
|
+
Style/RedundantAssignment:
|
303
|
+
Enabled: true
|
304
|
+
|
251
305
|
# Checks for an obsolete RuntimeException argument in raise/fail.
|
252
306
|
Style/RedundantException:
|
253
307
|
Enabled: true
|
254
308
|
|
309
|
+
# Identifies places where fetch(key) { value } can be replaced by fetch(key, value).
|
310
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantfetchblock
|
311
|
+
Style/RedundantFetchBlock:
|
312
|
+
Enabled: true
|
313
|
+
|
314
|
+
# Checks for the presence of superfluous .rb extension in the filename provided to require and require_relative.
|
315
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantfileextensioninrequire
|
316
|
+
Style/RedundantFileExtensionInRequire:
|
317
|
+
Enabled: true
|
318
|
+
|
255
319
|
# Checks for parentheses that seem not to serve any purpose.
|
256
320
|
Style/RedundantParentheses:
|
257
321
|
Enabled: true
|
@@ -260,6 +324,16 @@ Style/RedundantParentheses:
|
|
260
324
|
Style/RedundantPercentQ:
|
261
325
|
Enabled: false
|
262
326
|
|
327
|
+
# Checks for unnecessary single-element Regexp character classes.
|
328
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantregexpcharacterclass
|
329
|
+
Style/RedundantRegexpCharacterClass:
|
330
|
+
Enabled: true
|
331
|
+
|
332
|
+
# Checks for redundant escapes inside Regexp literals.
|
333
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantregexpescape
|
334
|
+
Style/RedundantRegexpEscape:
|
335
|
+
Enabled: true
|
336
|
+
|
263
337
|
# Use `sort` instead of `sort_by { |x| x }`.
|
264
338
|
Style/RedundantSortBy:
|
265
339
|
Enabled: true
|
@@ -268,16 +342,31 @@ Style/RedundantSortBy:
|
|
268
342
|
Style/Semicolon:
|
269
343
|
Enabled: true
|
270
344
|
|
345
|
+
# Sometimes using dig method ends up with just a single argument. In such cases, dig should be replaced with [].
|
346
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylesingleargumentdig
|
347
|
+
Style/SingleArgumentDig:
|
348
|
+
Enabled: true
|
349
|
+
|
271
350
|
# Checks for proper usage of fail and raise.
|
272
351
|
Style/SignalException:
|
273
352
|
EnforcedStyle: only_raise
|
274
353
|
Enabled: true
|
275
354
|
|
355
|
+
# Checks that arrays are sliced with endless ranges instead of ary[start..-1] on Ruby 2.6+.
|
356
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleslicingwithrange
|
357
|
+
Style/SlicingWithRange:
|
358
|
+
Enabled: true
|
359
|
+
|
276
360
|
# Check for the usage of parentheses around stabby lambda arguments.
|
277
361
|
Style/StabbyLambdaParentheses:
|
278
362
|
EnforcedStyle: require_parentheses
|
279
363
|
Enabled: true
|
280
364
|
|
365
|
+
# Checks for places where string concatenation can be replaced with string interpolation.
|
366
|
+
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylestringconcatenation
|
367
|
+
Style/StringConcatenation:
|
368
|
+
Enabled: true
|
369
|
+
|
281
370
|
# Checks if uses of quotes match the configured preference.
|
282
371
|
Style/StringLiterals:
|
283
372
|
Enabled: false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-styles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.89.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.89.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop-gitlab-security
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,42 +44,42 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.8.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.8.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
61
|
+
version: '2.8'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '2.
|
68
|
+
version: '2.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.44'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.44'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,12 +129,13 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".editorconfig"
|
132
133
|
- ".gitignore"
|
133
134
|
- ".gitlab-ci.yml"
|
135
|
+
- ".gitlab/merge_request_templates/New Static Analysis Check.md"
|
134
136
|
- ".gitlab/merge_request_templates/Release.md"
|
135
137
|
- ".rspec"
|
136
138
|
- ".rubocop.yml"
|
137
|
-
- ".rubocop_todo.yml"
|
138
139
|
- CODE_OF_CONDUCT.md
|
139
140
|
- CONTRIBUTING.md
|
140
141
|
- Gemfile
|
@@ -148,22 +149,30 @@ files:
|
|
148
149
|
- lib/gitlab/styles/rubocop.rb
|
149
150
|
- lib/gitlab/styles/rubocop/cop/active_record_dependent.rb
|
150
151
|
- lib/gitlab/styles/rubocop/cop/active_record_serialize.rb
|
152
|
+
- lib/gitlab/styles/rubocop/cop/code_reuse/active_record.rb
|
151
153
|
- lib/gitlab/styles/rubocop/cop/custom_error_class.rb
|
152
154
|
- lib/gitlab/styles/rubocop/cop/gem_fetcher.rb
|
153
155
|
- lib/gitlab/styles/rubocop/cop/in_batches.rb
|
154
156
|
- lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb
|
157
|
+
- lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb
|
155
158
|
- lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb
|
156
159
|
- lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb
|
157
160
|
- lib/gitlab/styles/rubocop/cop/redirect_with_status.rb
|
161
|
+
- lib/gitlab/styles/rubocop/cop/rspec/base.rb
|
162
|
+
- lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb
|
163
|
+
- lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb
|
164
|
+
- lib/gitlab/styles/rubocop/cop/rspec/example_starting_character.rb
|
158
165
|
- lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb
|
159
166
|
- lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb
|
160
167
|
- lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb
|
161
168
|
- lib/gitlab/styles/rubocop/cop/without_reactive_cache.rb
|
162
169
|
- lib/gitlab/styles/rubocop/migration_helpers.rb
|
163
170
|
- lib/gitlab/styles/rubocop/model_helpers.rb
|
171
|
+
- lib/gitlab/styles/rubocop/rspec/helpers.rb
|
164
172
|
- lib/gitlab/styles/version.rb
|
165
173
|
- rubocop-all.yml
|
166
174
|
- rubocop-bundler.yml
|
175
|
+
- rubocop-code_reuse.yml
|
167
176
|
- rubocop-default.yml
|
168
177
|
- rubocop-gemspec.yml
|
169
178
|
- rubocop-layout.yml
|
@@ -188,14 +197,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
197
|
requirements:
|
189
198
|
- - ">="
|
190
199
|
- !ruby/object:Gem::Version
|
191
|
-
version: '
|
200
|
+
version: '2.6'
|
192
201
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
202
|
requirements:
|
194
203
|
- - ">="
|
195
204
|
- !ruby/object:Gem::Version
|
196
205
|
version: '0'
|
197
206
|
requirements: []
|
198
|
-
rubygems_version: 3.1.
|
207
|
+
rubygems_version: 3.1.4
|
199
208
|
signing_key:
|
200
209
|
specification_version: 4
|
201
210
|
summary: GitLab style guides and shared style configs.
|
data/.rubocop_todo.yml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2017-11-03 15:49:59 +0100 using RuboCop version 0.51.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.
|