gitlab-styles 3.4.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5f56cd42de5afd61307ea92fd0114cb64e79b575697800b948e6d3e42e32d7c
4
- data.tar.gz: 25c343aae93b4bb8d03d57b92152c5c51433cacec86c86b6449ba8a6af3cc6e2
3
+ metadata.gz: 9d23f16df66558ac47e1084f4558dbf68589e7c81a3e99056e193500962c6608
4
+ data.tar.gz: 0aedb037f3ef8a90a2c3c0c80945949832eaa52da9ec5c3f872d8fc24157f300
5
5
  SHA512:
6
- metadata.gz: a7e7dbc2a80150595404fb1639266f462687668411b4410378a1021d9d07915fec14d6b34265d2a6672d65e5005cb4e2d7a1e99acff2ddbe0bc827280dc1c011
7
- data.tar.gz: c0b9073e17bf0c11f283ef485612746c3baa1a6de27392029ca930413f939cc192d797e0a3a3016da2db0bdc219444c93129199fbba9ab81e533f86182c65d10
6
+ metadata.gz: 478c9a5284aeb471ca82131d10496ce730126c1a66fb87f6a369153bb4ef65850fef4a92834cc5ac23ea66ef000afdbc2803a05fded8332a14eee08673aa4c36
7
+ data.tar.gz: 1675434965d80d42e2ffd7fff89eb84460d6bc70c4971e3fcf826273a118a55967a96446addf8454d851ebbbf097adf33a5f0498de1fb8c4b2e63b47a8ca103a
data/.gitignore CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ # Ignore IDE specific files
14
+ .idea/
data/Gemfile CHANGED
@@ -7,6 +7,6 @@ gemspec
7
7
 
8
8
  group :test do
9
9
  # Pin these dependencies, otherwise a new rule could break the CI pipelines
10
- gem 'rubocop', '0.74.0'
10
+ gem 'rubocop', '0.82.0'
11
11
  gem 'rubocop-rspec', '1.36.0'
12
12
  end
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.add_dependency 'rubocop', '~> 0.74.0'
24
+ spec.add_dependency 'rubocop', '~> 0.82.0'
25
25
  spec.add_dependency 'rubocop-gitlab-security', '~> 0.1.0'
26
- spec.add_dependency 'rubocop-performance', '~> 1.4.1'
27
- spec.add_dependency 'rubocop-rails', '~> 2.0'
26
+ spec.add_dependency 'rubocop-performance', '~> 1.5.2'
27
+ spec.add_dependency 'rubocop-rails', '~> 2.5'
28
28
  spec.add_dependency 'rubocop-rspec', '~> 1.36'
29
29
 
30
30
  spec.add_development_dependency 'bundler', '~> 1.16'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Styles
5
- VERSION = '3.4.0'
5
+ VERSION = '4.0.0'
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
2
+ TargetRubyVersion: 2.6
3
3
  # Cop names are not displayed in offense messages by default. Change behavior
4
4
  # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
5
5
  # option.
@@ -3,18 +3,14 @@ Layout/AccessModifierIndentation:
3
3
  Enabled: true
4
4
 
5
5
  # Align the elements of an array literal if they span more than one line.
6
- Layout/AlignArray:
6
+ Layout/ArrayAlignment:
7
7
  Enabled: true
8
8
 
9
- # Align the elements of a hash literal if they span more than one line.
10
- Layout/AlignHash:
9
+ # Checks the indentation of the first line of the right-hand-side of a
10
+ # multi-line assignment.
11
+ Layout/AssignmentIndentation:
11
12
  Enabled: true
12
13
 
13
- # Here we check if the parameters on a multi-line method call or
14
- # definition are aligned.
15
- Layout/AlignParameters:
16
- Enabled: false
17
-
18
14
  # Align block ends correctly.
19
15
  Layout/BlockAlignment:
20
16
  Enabled: true
@@ -102,27 +98,36 @@ Layout/ExtraSpacing:
102
98
  Layout/FirstMethodParameterLineBreak:
103
99
  Enabled: true
104
100
 
101
+ # Align the elements of a hash literal if they span more than one line.
102
+ Layout/HashAlignment:
103
+ Enabled: true
104
+
105
+ # This cops checks the indentation of the here document bodies.
106
+ Layout/HeredocIndentation:
107
+ Enabled: false
108
+
105
109
  # Keep indentation straight.
106
110
  Layout/IndentationConsistency:
107
111
  Enabled: true
108
112
 
109
- # Use 2 spaces for indentation.
110
- Layout/IndentationWidth:
113
+ # No hard tabs.
114
+ Layout/IndentationStyle:
111
115
  Enabled: true
112
116
 
113
- # Checks the indentation of the first line of the right-hand-side of a
114
- # multi-line assignment.
115
- Layout/IndentAssignment:
117
+ # Use 2 spaces for indentation.
118
+ Layout/IndentationWidth:
116
119
  Enabled: true
117
120
 
118
- # This cops checks the indentation of the here document bodies.
119
- Layout/IndentHeredoc:
120
- Enabled: false
121
-
122
121
  # Comments should start with a space.
123
122
  Layout/LeadingCommentSpace:
124
123
  Enabled: true
125
124
 
125
+ # Limit lines to 120 characters.
126
+ Layout/LineLength:
127
+ Enabled: true
128
+ Max: 120
129
+ IgnoredPatterns: ['\s#\srubocop']
130
+
126
131
  # Checks that the closing brace in an array literal is either on the same line
127
132
  # as the last array element, or a new line.
128
133
  Layout/MultilineArrayBraceLayout:
@@ -160,6 +165,11 @@ Layout/MultilineOperationIndentation:
160
165
  Enabled: true
161
166
  EnforcedStyle: indented
162
167
 
168
+ # Here we check if the parameters on a multi-line method call or
169
+ # definition are aligned.
170
+ Layout/ParameterAlignment:
171
+ Enabled: false
172
+
163
173
  # Use spaces after colons.
164
174
  Layout/SpaceAfterColon:
165
175
  Enabled: true
@@ -189,6 +199,10 @@ Layout/SpaceAroundEqualsInParameterDefault:
189
199
  Layout/SpaceAroundKeyword:
190
200
  Enabled: true
191
201
 
202
+ # Checks method call operators to not have spaces around them.
203
+ Layout/SpaceAroundMethodCallOperator:
204
+ Enabled: true
205
+
192
206
  # Use a single space around operators.
193
207
  Layout/SpaceAroundOperators:
194
208
  Enabled: true
@@ -235,12 +249,8 @@ Layout/SpaceInsideStringInterpolation:
235
249
  EnforcedStyle: no_space
236
250
  Enabled: true
237
251
 
238
- # No hard tabs.
239
- Layout/Tab:
240
- Enabled: true
241
-
242
252
  # Checks trailing blank lines and final newline.
243
- Layout/TrailingBlankLines:
253
+ Layout/TrailingEmptyLines:
244
254
  Enabled: true
245
255
 
246
256
  # Avoid trailing whitespace.
@@ -47,10 +47,6 @@ Lint/EmptyEnsure:
47
47
  Lint/EmptyWhen:
48
48
  Enabled: true
49
49
 
50
- # END blocks should not be placed inside method definitions.
51
- Lint/EndInMethod:
52
- Enabled: true
53
-
54
50
  # Do not use return in an ensure block.
55
51
  Lint/EnsureReturn:
56
52
  Enabled: true
@@ -67,10 +63,6 @@ Lint/FloatOutOfRange:
67
63
  Lint/FormatParameterMismatch:
68
64
  Enabled: true
69
65
 
70
- # This cop checks for *rescue* blocks with no body.
71
- Lint/HandleExceptions:
72
- Enabled: false
73
-
74
66
  # Checks for adjacent string literals on the same line, which could better be
75
67
  # represented as a single string literal.
76
68
  Lint/ImplicitStringConcatenation:
@@ -105,11 +97,23 @@ Lint/NextWithoutAccumulator:
105
97
  Lint/ParenthesesAsGroupedExpression:
106
98
  Enabled: true
107
99
 
100
+ # Checks for raise or fail statements which are raising Exception class.
101
+ Lint/RaiseException:
102
+ Enabled: true
103
+
108
104
  # Checks for `rand(1)` calls. Such calls always return `0` and most likely
109
105
  # a mistake.
110
106
  Lint/RandOne:
111
107
  Enabled: true
112
108
 
109
+ # This cop checks for unneeded usages of splat expansion
110
+ Lint/RedundantSplatExpansion:
111
+ Enabled: false
112
+
113
+ # Checks for Object#to_s usage in string interpolation.
114
+ Lint/RedundantStringCoercion:
115
+ Enabled: true
116
+
113
117
  # Use parentheses in the method call to avoid confusion about precedence.
114
118
  Lint/RequireParentheses:
115
119
  Enabled: true
@@ -131,10 +135,14 @@ Lint/ShadowedException:
131
135
  Lint/ShadowingOuterLocalVariable:
132
136
  Enabled: false
133
137
 
134
- # Checks for Object#to_s usage in string interpolation.
135
- Lint/StringConversionInInterpolation:
138
+ # Checks unexpected overrides of the Struct built-in methods via Struct.new.
139
+ Lint/StructNewOverride:
136
140
  Enabled: true
137
141
 
142
+ # This cop checks for *rescue* blocks with no body.
143
+ Lint/SuppressedException:
144
+ Enabled: false
145
+
138
146
  # Do not use prefix `_` for a variable that is used.
139
147
  Lint/UnderscorePrefixedVariableName:
140
148
  Enabled: true
@@ -143,10 +151,6 @@ Lint/UnderscorePrefixedVariableName:
143
151
  Lint/UnifiedInteger:
144
152
  Enabled: true
145
153
 
146
- # This cop checks for unneeded usages of splat expansion
147
- Lint/UnneededSplatExpansion:
148
- Enabled: false
149
-
150
154
  # Unreachable code.
151
155
  Lint/UnreachableCode:
152
156
  Enabled: true
@@ -23,12 +23,6 @@ Metrics/CyclomaticComplexity:
23
23
  Enabled: true
24
24
  Max: 13
25
25
 
26
- # Limit lines to 120 characters.
27
- Metrics/LineLength:
28
- Enabled: true
29
- Max: 120
30
- IgnoredPatterns: ['\s#\srubocop']
31
-
32
26
  # Avoid methods longer than 10 lines of code.
33
27
  Metrics/MethodLength:
34
28
  Enabled: false
@@ -30,6 +30,13 @@ Naming/MemoizedInstanceVariableName:
30
30
  Naming/MethodName:
31
31
  Enabled: true
32
32
 
33
+ # Method parameter names for how descriptive they are.
34
+ Naming/MethodParameterName:
35
+ Enabled: true
36
+ MinNameLength: 2
37
+ AllowedNames:
38
+ - _
39
+
33
40
  # Use `spam?` instead of `is_spam?`
34
41
  # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
35
42
  # NamePrefix: is_, has_, have_
@@ -37,18 +44,11 @@ Naming/MethodName:
37
44
  # NameWhitelist: is_a?
38
45
  Naming/PredicateName:
39
46
  Enabled: true
40
- NamePrefixBlacklist: is_
47
+ ForbiddenPrefixes: is_
41
48
  Exclude:
42
49
  - 'spec/**/*'
43
50
  - 'features/**/*'
44
51
 
45
- # Method parameter names for how descriptive they are.
46
- Naming/UncommunicativeMethodParamName:
47
- Enabled: true
48
- MinNameLength: 2
49
- AllowedNames:
50
- - _
51
-
52
52
  # Use the configured style when naming variables.
53
53
  Naming/VariableName:
54
54
  EnforcedStyle: snake_case
@@ -33,11 +33,6 @@ Style/BlockComments:
33
33
  Style/BlockDelimiters:
34
34
  Enabled: true
35
35
 
36
- # This cop checks for braces around the last parameter in a method call
37
- # if the last parameter is a hash.
38
- Style/BracesAroundHashParameters:
39
- Enabled: false
40
-
41
36
  # This cop checks for uses of the case equality operator(===).
42
37
  Style/CaseEquality:
43
38
  Enabled: false
@@ -100,6 +95,10 @@ Style/EndBlock:
100
95
  Style/EvenOdd:
101
96
  Enabled: true
102
97
 
98
+ # Enforces consistency when using exponential notation for numbers in the code
99
+ Style/ExponentialNotation:
100
+ Enabled: true
101
+
103
102
  # Checks use of for or each in multiline loops.
104
103
  Style/For:
105
104
  Enabled: true
@@ -119,11 +118,27 @@ Style/GlobalVars:
119
118
  - 'lib/backup/**/*'
120
119
  - 'lib/tasks/**/*'
121
120
 
121
+ # Checks for uses of each_key and each_value Hash methods.
122
+ Style/HashEachMethods:
123
+ Enabled: true
124
+
122
125
  # Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
123
126
  # over 1.8 syntax `{ :a => 1, :b => 2 }`.
124
127
  Style/HashSyntax:
125
128
  Enabled: true
126
129
 
130
+ # looks for uses of _.each_with_object({}) {...}, _.map {...}.to_h, and Hash[_.map {...}]
131
+ # that are actually just transforming the keys of a hash, and tries to use a simpler & faster
132
+ # call to transform_keys instead.
133
+ Style/HashTransformKeys:
134
+ Enabled: true
135
+
136
+ # looks for uses of _.each_with_object({}) {...}, _.map {...}.to_h, and Hash[_.map {...}]
137
+ # that are actually just transforming the values of a hash, and tries to use a simpler & faster
138
+ # call to transform_values instead.
139
+ Style/HashTransformValues:
140
+ Enabled: true
141
+
127
142
  # Checks that conditional statements do not have an identical line at the
128
143
  # end of each branch, which can validly be moved out of the conditional.
129
144
  Style/IdenticalConditionalBranches:
@@ -229,6 +244,10 @@ Style/ParenthesesAroundCondition:
229
244
  Style/PreferredHashMethods:
230
245
  Enabled: false
231
246
 
247
+ # Checks for %W when interpolation is not needed.
248
+ Style/RedundantCapitalW:
249
+ Enabled: true
250
+
232
251
  # Checks for an obsolete RuntimeException argument in raise/fail.
233
252
  Style/RedundantException:
234
253
  Enabled: true
@@ -237,6 +256,10 @@ Style/RedundantException:
237
256
  Style/RedundantParentheses:
238
257
  Enabled: true
239
258
 
259
+ # Checks for %q/%Q when single quotes or double quotes would do.
260
+ Style/RedundantPercentQ:
261
+ Enabled: false
262
+
240
263
  # Use `sort` instead of `sort_by { |x| x }`.
241
264
  Style/RedundantSortBy:
242
265
  Enabled: true
@@ -284,14 +307,6 @@ Style/TrailingCommaInArguments:
284
307
  Enabled: true
285
308
  EnforcedStyleForMultiline: no_comma
286
309
 
287
- # Checks for %W when interpolation is not needed.
288
- Style/UnneededCapitalW:
289
- Enabled: true
290
-
291
- # Checks for %q/%Q when single quotes or double quotes would do.
292
- Style/UnneededPercentQ:
293
- Enabled: false
294
-
295
310
  # Don't interpolate global, instance and class variables directly in strings.
296
311
  Style/VariableInterpolation:
297
312
  Enabled: true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-styles
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-10 00:00:00.000000000 Z
11
+ date: 2020-04-17 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.74.0
19
+ version: 0.82.0
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.74.0
26
+ version: 0.82.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-gitlab-security
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.4.1
47
+ version: 1.5.2
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.4.1
54
+ version: 1.5.2
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.0'
61
+ version: '2.5'
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.0'
68
+ version: '2.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rspec
71
71
  requirement: !ruby/object:Gem::Requirement