gitlab-styles 2.0.0 → 2.1.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 +5 -5
- data/.gitlab-ci.yml +2 -2
- data/.rubocop.yml +3 -1
- data/.rubocop_todo.yml +7 -0
- data/README.md +28 -1
- data/gitlab-styles.gemspec +3 -3
- data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/active_record_serialize.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/in_batches.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/redirect_with_status.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb +3 -3
- data/lib/gitlab/styles/version.rb +1 -1
- data/rubocop-all.yml +10 -0
- data/rubocop-bundler.yml +3 -0
- data/rubocop-default.yml +13 -1215
- data/rubocop-gemspec.yml +5 -0
- data/rubocop-layout.yml +221 -0
- data/rubocop-lint.yml +198 -0
- data/rubocop-metrics.yml +46 -0
- data/rubocop-naming.yml +48 -0
- data/rubocop-performance.yml +55 -0
- data/rubocop-rails.yml +97 -0
- data/rubocop-rspec.yml +143 -0
- data/rubocop-security.yml +46 -0
- data/rubocop-style.yml +312 -0
- metadata +26 -13
data/rubocop-gemspec.yml
ADDED
data/rubocop-layout.yml
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
# Check indentation of private/protected visibility modifiers.
|
2
|
+
Layout/AccessModifierIndentation:
|
3
|
+
Enabled: true
|
4
|
+
|
5
|
+
# Align the elements of an array literal if they span more than one line.
|
6
|
+
Layout/AlignArray:
|
7
|
+
Enabled: true
|
8
|
+
|
9
|
+
# Align the elements of a hash literal if they span more than one line.
|
10
|
+
Layout/AlignHash:
|
11
|
+
Enabled: true
|
12
|
+
|
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
|
+
# Put end statement of multiline block on its own line.
|
19
|
+
Layout/BlockEndNewline:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
# Indentation of when in a case/when/[else/]end.
|
23
|
+
Layout/CaseIndentation:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
# Indentation of comments.
|
27
|
+
Layout/CommentIndentation:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
# Multi-line method chaining should be done with leading dots.
|
31
|
+
Layout/DotPosition:
|
32
|
+
Enabled: true
|
33
|
+
EnforcedStyle: leading
|
34
|
+
|
35
|
+
# Align elses and elsifs correctly.
|
36
|
+
Layout/ElseAlignment:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
# Add an empty line after magic comments to separate them from code.
|
40
|
+
Layout/EmptyLineAfterMagicComment:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
# Use empty lines between defs.
|
44
|
+
Layout/EmptyLineBetweenDefs:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
# Don't use several empty lines in a row.
|
48
|
+
Layout/EmptyLines:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
# Keep blank lines around access modifiers.
|
52
|
+
Layout/EmptyLinesAroundAccessModifier:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
# Keeps track of empty lines around block bodies.
|
56
|
+
Layout/EmptyLinesAroundBlockBody:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
# Keeps track of empty lines around class bodies.
|
60
|
+
Layout/EmptyLinesAroundClassBody:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
# Keeps track of empty lines around exception handling keywords.
|
64
|
+
Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# Keeps track of empty lines around method bodies.
|
68
|
+
Layout/EmptyLinesAroundMethodBody:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
# Keeps track of empty lines around module bodies.
|
72
|
+
Layout/EmptyLinesAroundModuleBody:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
# Use Unix-style line endings.
|
76
|
+
Layout/EndOfLine:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
# Checks for a line break before the first parameter in a multi-line method
|
80
|
+
# parameter definition.
|
81
|
+
Layout/FirstMethodParameterLineBreak:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
# Keep indentation straight.
|
85
|
+
Layout/IndentationConsistency:
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
# Use 2 spaces for indentation.
|
89
|
+
Layout/IndentationWidth:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
# Checks the indentation of the first line of the right-hand-side of a
|
93
|
+
# multi-line assignment.
|
94
|
+
Layout/IndentAssignment:
|
95
|
+
Enabled: true
|
96
|
+
|
97
|
+
# This cops checks the indentation of the here document bodies.
|
98
|
+
Layout/IndentHeredoc:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
# Comments should start with a space.
|
102
|
+
Layout/LeadingCommentSpace:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
# Checks that the closing brace in an array literal is either on the same line
|
106
|
+
# as the last array element, or a new line.
|
107
|
+
Layout/MultilineArrayBraceLayout:
|
108
|
+
Enabled: true
|
109
|
+
EnforcedStyle: symmetrical
|
110
|
+
|
111
|
+
# Ensures newlines after multiline block do statements.
|
112
|
+
Layout/MultilineBlockLayout:
|
113
|
+
Enabled: true
|
114
|
+
|
115
|
+
# Checks that the closing brace in a hash literal is either on the same line as
|
116
|
+
# the last hash element, or a new line.
|
117
|
+
Layout/MultilineHashBraceLayout:
|
118
|
+
Enabled: true
|
119
|
+
EnforcedStyle: symmetrical
|
120
|
+
|
121
|
+
# Checks that the closing brace in a method call is either on the same line as
|
122
|
+
# the last method argument, or a new line.
|
123
|
+
Layout/MultilineMethodCallBraceLayout:
|
124
|
+
Enabled: false
|
125
|
+
EnforcedStyle: symmetrical
|
126
|
+
|
127
|
+
# Checks indentation of method calls with the dot operator that span more than
|
128
|
+
# one line.
|
129
|
+
Layout/MultilineMethodCallIndentation:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
# Checks that the closing brace in a method definition is symmetrical with
|
133
|
+
# respect to the opening brace and the method parameters.
|
134
|
+
Layout/MultilineMethodDefinitionBraceLayout:
|
135
|
+
Enabled: false
|
136
|
+
|
137
|
+
# Checks indentation of binary operations that span more than one line.
|
138
|
+
Layout/MultilineOperationIndentation:
|
139
|
+
Enabled: true
|
140
|
+
EnforcedStyle: indented
|
141
|
+
|
142
|
+
# Use spaces after colons.
|
143
|
+
Layout/SpaceAfterColon:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
# Use spaces after commas.
|
147
|
+
Layout/SpaceAfterComma:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
# Do not put a space between a method name and the opening parenthesis in a
|
151
|
+
# method definition.
|
152
|
+
Layout/SpaceAfterMethodName:
|
153
|
+
Enabled: true
|
154
|
+
|
155
|
+
# Tracks redundant space after the ! operator.
|
156
|
+
Layout/SpaceAfterNot:
|
157
|
+
Enabled: true
|
158
|
+
|
159
|
+
# Use spaces after semicolons.
|
160
|
+
Layout/SpaceAfterSemicolon:
|
161
|
+
Enabled: true
|
162
|
+
|
163
|
+
# Use space around equals in parameter default
|
164
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
165
|
+
Enabled: true
|
166
|
+
|
167
|
+
# Use a space around keywords if appropriate.
|
168
|
+
Layout/SpaceAroundKeyword:
|
169
|
+
Enabled: true
|
170
|
+
|
171
|
+
# Use a single space around operators.
|
172
|
+
Layout/SpaceAroundOperators:
|
173
|
+
Enabled: true
|
174
|
+
|
175
|
+
# Checks that block braces have or don't have a space before the opening
|
176
|
+
# brace depending on configuration.
|
177
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
178
|
+
# SupportedStyles: space, no_space
|
179
|
+
Layout/SpaceBeforeBlockBraces:
|
180
|
+
Enabled: true
|
181
|
+
|
182
|
+
# No spaces before commas.
|
183
|
+
Layout/SpaceBeforeComma:
|
184
|
+
Enabled: true
|
185
|
+
|
186
|
+
# Checks for missing space between code and a comment on the same line.
|
187
|
+
Layout/SpaceBeforeComment:
|
188
|
+
Enabled: true
|
189
|
+
|
190
|
+
# No spaces before semicolons.
|
191
|
+
Layout/SpaceBeforeSemicolon:
|
192
|
+
Enabled: true
|
193
|
+
|
194
|
+
# Checks for spaces inside square brackets.
|
195
|
+
Layout/SpaceInsideBrackets:
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
# Use spaces inside hash literal braces - or don't.
|
199
|
+
Layout/SpaceInsideHashLiteralBraces:
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
# No spaces inside range literals.
|
203
|
+
Layout/SpaceInsideRangeLiteral:
|
204
|
+
Enabled: true
|
205
|
+
|
206
|
+
# Checks for padding/surrounding spaces inside string interpolation.
|
207
|
+
Layout/SpaceInsideStringInterpolation:
|
208
|
+
EnforcedStyle: no_space
|
209
|
+
Enabled: true
|
210
|
+
|
211
|
+
# No hard tabs.
|
212
|
+
Layout/Tab:
|
213
|
+
Enabled: true
|
214
|
+
|
215
|
+
# Checks trailing blank lines and final newline.
|
216
|
+
Layout/TrailingBlankLines:
|
217
|
+
Enabled: true
|
218
|
+
|
219
|
+
# Avoid trailing whitespace.
|
220
|
+
Layout/TrailingWhitespace:
|
221
|
+
Enabled: true
|
data/rubocop-lint.yml
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
# Checks for ambiguous block association with method when param passed without
|
2
|
+
# parentheses.
|
3
|
+
Lint/AmbiguousBlockAssociation:
|
4
|
+
Enabled: false
|
5
|
+
|
6
|
+
# Checks for ambiguous operators in the first argument of a method invocation
|
7
|
+
# without parentheses.
|
8
|
+
Lint/AmbiguousOperator:
|
9
|
+
Enabled: true
|
10
|
+
|
11
|
+
# This cop checks for ambiguous regexp literals in the first argument of
|
12
|
+
# a method invocation without parentheses.
|
13
|
+
Lint/AmbiguousRegexpLiteral:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
# This cop checks for assignments in the conditions of
|
17
|
+
# if/while/until.
|
18
|
+
Lint/AssignmentInCondition:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
# Align block ends correctly.
|
22
|
+
Lint/BlockAlignment:
|
23
|
+
Enabled: true
|
24
|
+
|
25
|
+
# Default values in optional keyword arguments and optional ordinal arguments
|
26
|
+
# should not refer back to the name of the argument.
|
27
|
+
Lint/CircularArgumentReference:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
# Checks for condition placed in a confusing position relative to the keyword.
|
31
|
+
Lint/ConditionPosition:
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
# Check for debugger calls.
|
35
|
+
Lint/Debugger:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
# Align ends corresponding to defs correctly.
|
39
|
+
Lint/DefEndAlignment:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
# Check for deprecated class method calls.
|
43
|
+
Lint/DeprecatedClassMethods:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
# Check for immutable argument given to each_with_object.
|
47
|
+
Lint/EachWithObjectArgument:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
# Check for odd code arrangement in an else block.
|
51
|
+
Lint/ElseLayout:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
# Checks for empty ensure block.
|
55
|
+
Lint/EmptyEnsure:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
# Checks for the presence of `when` branches without a body.
|
59
|
+
Lint/EmptyWhen:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
# Align ends correctly.
|
63
|
+
Lint/EndAlignment:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
# END blocks should not be placed inside method definitions.
|
67
|
+
Lint/EndInMethod:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
# Do not use return in an ensure block.
|
71
|
+
Lint/EnsureReturn:
|
72
|
+
Enabled: true
|
73
|
+
|
74
|
+
# Catches floating-point literals too large or small for Ruby to represent.
|
75
|
+
Lint/FloatOutOfRange:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
# The number of parameters to format/sprint must match the fields.
|
79
|
+
Lint/FormatParameterMismatch:
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
# This cop checks for *rescue* blocks with no body.
|
83
|
+
Lint/HandleExceptions:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
# Checks for adjacent string literals on the same line, which could better be
|
87
|
+
# represented as a single string literal.
|
88
|
+
Lint/ImplicitStringConcatenation:
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
# Checks for attempts to use `private` or `protected` to set the visibility
|
92
|
+
# of a class method, which does not work.
|
93
|
+
Lint/IneffectiveAccessModifier:
|
94
|
+
Enabled: false
|
95
|
+
|
96
|
+
# Checks of literals used in conditions.
|
97
|
+
Lint/LiteralAsCondition:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
# Checks for literals used in interpolation.
|
101
|
+
Lint/LiteralInInterpolation:
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
# This cop checks for uses of *begin...end while/until something*.
|
105
|
+
Lint/Loop:
|
106
|
+
Enabled: false
|
107
|
+
|
108
|
+
# Do not use nested method definitions.
|
109
|
+
Lint/NestedMethodDefinition:
|
110
|
+
Enabled: true
|
111
|
+
|
112
|
+
# Do not omit the accumulator when calling `next` in a `reduce`/`inject` block.
|
113
|
+
Lint/NextWithoutAccumulator:
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
# Checks for method calls with a space before the opening parenthesis.
|
117
|
+
Lint/ParenthesesAsGroupedExpression:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
# Checks for `rand(1)` calls. Such calls always return `0` and most likely
|
121
|
+
# a mistake.
|
122
|
+
Lint/RandOne:
|
123
|
+
Enabled: true
|
124
|
+
|
125
|
+
# Use parentheses in the method call to avoid confusion about precedence.
|
126
|
+
Lint/RequireParentheses:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
# Avoid rescuing the Exception class.
|
130
|
+
Lint/RescueException:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
# Checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception.
|
134
|
+
Lint/ShadowedException:
|
135
|
+
Enabled: false
|
136
|
+
|
137
|
+
# This cop looks for use of the same name as outer local variables
|
138
|
+
# for block arguments or block local variables.
|
139
|
+
Lint/ShadowingOuterLocalVariable:
|
140
|
+
Enabled: false
|
141
|
+
|
142
|
+
# Checks for Object#to_s usage in string interpolation.
|
143
|
+
Lint/StringConversionInInterpolation:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
# Do not use prefix `_` for a variable that is used.
|
147
|
+
Lint/UnderscorePrefixedVariableName:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
# This cop checks for using Fixnum or Bignum constant
|
151
|
+
Lint/UnifiedInteger:
|
152
|
+
Enabled: true
|
153
|
+
|
154
|
+
# Checks for rubocop:disable comments that can be removed.
|
155
|
+
# Note: this cop is not disabled when disabling all cops.
|
156
|
+
# It must be explicitly disabled.
|
157
|
+
Lint/UnneededDisable:
|
158
|
+
Enabled: false
|
159
|
+
|
160
|
+
# This cop checks for unneeded usages of splat expansion
|
161
|
+
Lint/UnneededSplatExpansion:
|
162
|
+
Enabled: false
|
163
|
+
|
164
|
+
# Unreachable code.
|
165
|
+
Lint/UnreachableCode:
|
166
|
+
Enabled: true
|
167
|
+
|
168
|
+
# This cop checks for unused block arguments.
|
169
|
+
Lint/UnusedBlockArgument:
|
170
|
+
Enabled: false
|
171
|
+
|
172
|
+
# This cop checks for unused method arguments.
|
173
|
+
Lint/UnusedMethodArgument:
|
174
|
+
Enabled: false
|
175
|
+
|
176
|
+
# Checks for useless access modifiers.
|
177
|
+
Lint/UselessAccessModifier:
|
178
|
+
Enabled: true
|
179
|
+
|
180
|
+
# Checks for useless assignment to a local variable.
|
181
|
+
Lint/UselessAssignment:
|
182
|
+
Enabled: true
|
183
|
+
|
184
|
+
# Checks for comparison of something with itself.
|
185
|
+
Lint/UselessComparison:
|
186
|
+
Enabled: true
|
187
|
+
|
188
|
+
# Checks for useless `else` in `begin..end` without `rescue`.
|
189
|
+
Lint/UselessElseWithoutRescue:
|
190
|
+
Enabled: true
|
191
|
+
|
192
|
+
# Checks for useless setter call to a local variable.
|
193
|
+
Lint/UselessSetterCall:
|
194
|
+
Enabled: true
|
195
|
+
|
196
|
+
# Possible use of operator/literal/variable in void context.
|
197
|
+
Lint/Void:
|
198
|
+
Enabled: true
|
data/rubocop-metrics.yml
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# A calculated magnitude based on number of assignments,
|
2
|
+
# branches, and conditions.
|
3
|
+
Metrics/AbcSize:
|
4
|
+
Enabled: true
|
5
|
+
Max: 54.28
|
6
|
+
|
7
|
+
# This cop checks if the length of a block exceeds some maximum value.
|
8
|
+
Metrics/BlockLength:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
# Avoid excessive block nesting.
|
12
|
+
Metrics/BlockNesting:
|
13
|
+
Enabled: true
|
14
|
+
Max: 4
|
15
|
+
|
16
|
+
# Avoid classes longer than 100 lines of code.
|
17
|
+
Metrics/ClassLength:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# A complexity metric that is strongly correlated to the number
|
21
|
+
# of test cases needed to validate a method.
|
22
|
+
Metrics/CyclomaticComplexity:
|
23
|
+
Enabled: true
|
24
|
+
Max: 13
|
25
|
+
|
26
|
+
# Limit lines to 80 characters.
|
27
|
+
Metrics/LineLength:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
# Avoid methods longer than 10 lines of code.
|
31
|
+
Metrics/MethodLength:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# Avoid modules longer than 100 lines of code.
|
35
|
+
Metrics/ModuleLength:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
# Avoid parameter lists longer than three or four parameters.
|
39
|
+
Metrics/ParameterLists:
|
40
|
+
Enabled: true
|
41
|
+
Max: 8
|
42
|
+
|
43
|
+
# A complexity metric geared towards measuring complexity for a human reader.
|
44
|
+
Metrics/PerceivedComplexity:
|
45
|
+
Enabled: true
|
46
|
+
Max: 14
|