gitlab-styles 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ # Check the naming of accessor methods for get_/set_.
2
+ Naming/AccessorMethodName:
3
+ Enabled: false
4
+
5
+ # Use only ascii symbols in identifiers.
6
+ Naming/AsciiIdentifiers:
7
+ Enabled: true
8
+
9
+ # When defining binary operators, name the argument other.
10
+ Naming/BinaryOperatorParameterName:
11
+ Enabled: true
12
+
13
+ # Use CamelCase for classes and modules.'
14
+ Naming/ClassAndModuleCamelCase:
15
+ Enabled: true
16
+
17
+ # Constants should use SCREAMING_SNAKE_CASE.
18
+ Naming/ConstantName:
19
+ Enabled: true
20
+
21
+ # Use snake_case for source file names.
22
+ Naming/FileName:
23
+ Enabled: true
24
+
25
+ # Use the configured style when naming methods.
26
+ Naming/MethodName:
27
+ Enabled: true
28
+
29
+ # Use `spam?` instead of `is_spam?`
30
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
31
+ # NamePrefix: is_, has_, have_
32
+ # NamePrefixBlacklist: is_, has_, have_
33
+ # NameWhitelist: is_a?
34
+ Naming/PredicateName:
35
+ Enabled: true
36
+ NamePrefixBlacklist: is_
37
+ Exclude:
38
+ - 'spec/**/*'
39
+ - 'features/**/*'
40
+
41
+ # Use the configured style when naming variables.
42
+ Naming/VariableName:
43
+ EnforcedStyle: snake_case
44
+ Enabled: true
45
+
46
+ # Use the configured style when numbering variables.
47
+ Naming/VariableNumber:
48
+ Enabled: false
@@ -0,0 +1,55 @@
1
+ # Use `caller(n..n)` instead of `caller`.
2
+ Performance/Caller:
3
+ Enabled: false
4
+
5
+ # Use `casecmp` rather than `downcase ==`.
6
+ Performance/Casecmp:
7
+ Enabled: true
8
+
9
+ # Use `str.{start,end}_with?(x, ..., y, ...)` instead of
10
+ # `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
11
+ Performance/DoubleStartEndWith:
12
+ Enabled: true
13
+
14
+ # Use `strip` instead of `lstrip.rstrip`.
15
+ Performance/LstripRstrip:
16
+ Enabled: true
17
+
18
+ # Use `Range#cover?` instead of `Range#include?`.
19
+ Performance/RangeInclude:
20
+ Enabled: true
21
+
22
+ # This cop identifies the use of a `&block` parameter and `block.call`
23
+ # where `yield` would do just as well.
24
+ Performance/RedundantBlockCall:
25
+ Enabled: true
26
+
27
+ # This cop identifies use of `Regexp#match` or `String#match in a context
28
+ # where the integral return value of `=~` would do just as well.
29
+ Performance/RedundantMatch:
30
+ Enabled: true
31
+
32
+ # This cop identifies places where `Hash#merge!` can be replaced by
33
+ # `Hash#[]=`.
34
+ Performance/RedundantMerge:
35
+ Enabled: true
36
+ MaxKeyValuePairs: 1
37
+
38
+ # Use `sort` instead of `sort_by { |x| x }`.
39
+ Performance/RedundantSortBy:
40
+ Enabled: true
41
+
42
+ # Use `start_with?` instead of a regex match anchored to the beginning of a
43
+ # string.
44
+ Performance/StartWith:
45
+ Enabled: true
46
+
47
+ # Use `tr` instead of `gsub` when you are replacing the same number of
48
+ # characters. Use `delete` instead of `gsub` when you are deleting
49
+ # characters.
50
+ Performance/StringReplacement:
51
+ Enabled: true
52
+
53
+ # Checks for `.times.map` calls.
54
+ Performance/TimesMap:
55
+ Enabled: true
@@ -0,0 +1,97 @@
1
+ # Enables Rails cops.
2
+ Rails:
3
+ Enabled: true
4
+
5
+ # Enforces consistent use of action filter methods.
6
+ Rails/ActionFilter:
7
+ Enabled: true
8
+ EnforcedStyle: action
9
+
10
+ # Check that models subclass ApplicationRecord.
11
+ Rails/ApplicationRecord:
12
+ Enabled: false
13
+
14
+ # Enforce using `blank?` and `present?`.
15
+ Rails/Blank:
16
+ Enabled: false
17
+
18
+ # Checks the correct usage of date aware methods, such as `Date.today`,
19
+ # `Date.current`, etc.
20
+ Rails/Date:
21
+ Enabled: false
22
+
23
+ # Prefer delegate method for delegations.
24
+ # Disabled per https://gitlab.com/gitlab-org/gitlab-ce/issues/35869
25
+ Rails/Delegate:
26
+ Enabled: false
27
+
28
+ # This cop checks dynamic `find_by_*` methods.
29
+ Rails/DynamicFindBy:
30
+ Enabled: false
31
+
32
+ # This cop enforces that 'exit' calls are not used within a rails app.
33
+ Rails/Exit:
34
+ Enabled: true
35
+ Exclude:
36
+ - lib/gitlab/upgrader.rb
37
+ - 'lib/backup/**/*'
38
+
39
+ # Prefer `find_by` over `where.first`.
40
+ Rails/FindBy:
41
+ Enabled: true
42
+
43
+ # Prefer `all.find_each` over `all.find`.
44
+ Rails/FindEach:
45
+ Enabled: true
46
+
47
+ # Prefer has_many :through to has_and_belongs_to_many.
48
+ Rails/HasAndBelongsToMany:
49
+ Enabled: true
50
+
51
+ # This cop is used to identify usages of http methods like `get`, `post`,
52
+ # `put`, `patch` without the usage of keyword arguments in your tests and
53
+ # change them to use keyword args.
54
+ Rails/HttpPositionalArguments:
55
+ Enabled: false
56
+
57
+ # Checks for calls to puts, print, etc.
58
+ Rails/Output:
59
+ Enabled: true
60
+ Exclude:
61
+ - lib/gitlab/seeder.rb
62
+ - lib/gitlab/upgrader.rb
63
+ - 'lib/backup/**/*'
64
+ - 'lib/tasks/**/*'
65
+
66
+ # This cop checks for the use of output safety calls like html_safe and
67
+ # raw.
68
+ Rails/OutputSafety:
69
+ Enabled: false
70
+
71
+ # Checks for incorrect grammar when using methods like `3.day.ago`.
72
+ Rails/PluralizationGrammar:
73
+ Enabled: true
74
+
75
+ # Enforce using `blank?` and `present?`.
76
+ Rails/Present:
77
+ Enabled: false
78
+
79
+ # Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
80
+ Rails/ReadWriteAttribute:
81
+ Enabled: false
82
+
83
+ # Do not assign relative date to constants.
84
+ Rails/RelativeDateConstant:
85
+ Enabled: false
86
+
87
+ # Checks the arguments of ActiveRecord scopes.
88
+ Rails/ScopeArgs:
89
+ Enabled: true
90
+
91
+ # This cop checks for the use of Time methods without zone.
92
+ Rails/TimeZone:
93
+ Enabled: false
94
+
95
+ # This cop checks for the use of old-style attribute validation macros.
96
+ Rails/Validation:
97
+ Enabled: true
@@ -0,0 +1,143 @@
1
+ # Check that instances are not being stubbed globally.
2
+ RSpec/AnyInstance:
3
+ Enabled: false
4
+
5
+ # Check for expectations where `be(...)` can replace `eql(...)`.
6
+ RSpec/BeEql:
7
+ Enabled: true
8
+
9
+ # We don't enforce this as we use this technique in a few places.
10
+ RSpec/BeforeAfterAll:
11
+ Enabled: false
12
+
13
+ # Check that the first argument to the top level describe is the tested class or
14
+ # module.
15
+ RSpec/DescribeClass:
16
+ Enabled: false
17
+
18
+ # Checks that the second argument to `describe` specifies a method.
19
+ RSpec/DescribeMethod:
20
+ Enabled: false
21
+
22
+ # Avoid describing symbols.
23
+ RSpec/DescribeSymbol:
24
+ Enabled: true
25
+
26
+ # Checks that tests use `described_class`.
27
+ RSpec/DescribedClass:
28
+ Enabled: true
29
+
30
+ # Checks if an example group does not include any tests.
31
+ RSpec/EmptyExampleGroup:
32
+ Enabled: true
33
+ CustomIncludeMethods:
34
+ - run_permission_checks
35
+ - run_group_permission_checks
36
+ - it_should_email!
37
+ - it_should_not_email!
38
+
39
+ # Checks for long example.
40
+ RSpec/ExampleLength:
41
+ Enabled: false
42
+ Max: 5
43
+
44
+ # Do not use should when describing your tests.
45
+ RSpec/ExampleWording:
46
+ Enabled: false
47
+ CustomTransform:
48
+ be: is
49
+ have: has
50
+ not: does not
51
+ IgnoredWords: []
52
+
53
+ # Checks for `expect(...)` calls containing literal values.
54
+ RSpec/ExpectActual:
55
+ Enabled: true
56
+
57
+ # Checks for opportunities to use `expect { … }.to output`.
58
+ RSpec/ExpectOutput:
59
+ Enabled: true
60
+
61
+ # Checks the file and folder naming of the spec file.
62
+ RSpec/FilePath:
63
+ Enabled: true
64
+ IgnoreMethods: true
65
+ Exclude:
66
+ - 'qa/**/*'
67
+ - 'spec/javascripts/fixtures/*'
68
+ - 'spec/requests/api/v3/*'
69
+
70
+ # Checks if there are focused specs.
71
+ RSpec/Focus:
72
+ Enabled: true
73
+
74
+ # Checks the arguments passed to `before`, `around`, and `after`.
75
+ RSpec/HookArgument:
76
+ Enabled: true
77
+ EnforcedStyle: implicit
78
+
79
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
80
+ # SupportedStyles: is_expected, should
81
+ RSpec/ImplicitExpect:
82
+ Enabled: true
83
+ EnforcedStyle: is_expected
84
+
85
+ # Checks for the usage of instance variables.
86
+ RSpec/InstanceVariable:
87
+ Enabled: false
88
+
89
+ # Checks for `subject` definitions that come after `let` definitions.
90
+ RSpec/LeadingSubject:
91
+ Enabled: false
92
+
93
+ # Checks unreferenced `let!` calls being used for test setup.
94
+ RSpec/LetSetup:
95
+ Enabled: false
96
+
97
+ # Check that chains of messages are not being stubbed.
98
+ RSpec/MessageChain:
99
+ Enabled: false
100
+
101
+ # Checks that message expectations are set using spies.
102
+ RSpec/MessageSpies:
103
+ Enabled: false
104
+
105
+ # Checks for multiple top-level describes.
106
+ RSpec/MultipleDescribes:
107
+ Enabled: false
108
+
109
+ # Checks if examples contain too many `expect` calls.
110
+ RSpec/MultipleExpectations:
111
+ Enabled: false
112
+
113
+ # Checks for explicitly referenced test subjects.
114
+ RSpec/NamedSubject:
115
+ Enabled: false
116
+
117
+ # Checks for nested example groups.
118
+ RSpec/NestedGroups:
119
+ Enabled: false
120
+
121
+ # Enforces the usage of the same method on all negative message expectations.
122
+ RSpec/NotToNot:
123
+ EnforcedStyle: not_to
124
+ Enabled: true
125
+
126
+ # Check for repeated description strings in example groups.
127
+ RSpec/RepeatedDescription:
128
+ Enabled: false
129
+
130
+ # Ensure RSpec hook blocks are always multi-line.
131
+ RSpec/SingleLineHook:
132
+ Enabled: true
133
+ Exclude:
134
+ - 'spec/factories/*'
135
+ - 'spec/requests/api/v3/*'
136
+
137
+ # Checks for stubbed test subjects.
138
+ RSpec/SubjectStub:
139
+ Enabled: false
140
+
141
+ # Prefer using verifying doubles over normal doubles.
142
+ RSpec/VerifiedDoubles:
143
+ Enabled: false
@@ -0,0 +1,46 @@
1
+ # This cop checks for the use of JSON class methods which have potential
2
+ # security issues.
3
+ Security/JSONLoad:
4
+ Enabled: true
5
+
6
+ # This cop checks for the use of *Kernel#eval*.
7
+ Security/Eval:
8
+ Enabled: true
9
+
10
+ GitlabSecurity/DeepMunge:
11
+ Enabled: true
12
+ Exclude:
13
+ - 'lib/**/*.rake'
14
+ - 'spec/**/*'
15
+
16
+ # To be enabled by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13610
17
+ GitlabSecurity/JsonSerialization:
18
+ Enabled: false
19
+
20
+ GitlabSecurity/PublicSend:
21
+ Enabled: true
22
+ Exclude:
23
+ - 'config/**/*'
24
+ - 'db/**/*'
25
+ - 'features/**/*'
26
+ - 'lib/**/*.rake'
27
+ - 'qa/**/*'
28
+ - 'spec/**/*'
29
+
30
+ GitlabSecurity/RedirectToParamsUpdate:
31
+ Enabled: true
32
+ Exclude:
33
+ - 'lib/**/*.rake'
34
+ - 'spec/**/*'
35
+
36
+ GitlabSecurity/SqlInjection:
37
+ Enabled: true
38
+ Exclude:
39
+ - 'lib/**/*.rake'
40
+ - 'spec/**/*'
41
+
42
+ GitlabSecurity/SystemCommandInjection:
43
+ Enabled: true
44
+ Exclude:
45
+ - 'lib/**/*.rake'
46
+ - 'spec/**/*'
@@ -0,0 +1,312 @@
1
+ # Use alias_method instead of alias.
2
+ Style/Alias:
3
+ EnforcedStyle: prefer_alias_method
4
+ Enabled: true
5
+
6
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
7
+ # or completely (always).
8
+ Style/AndOr:
9
+ Enabled: true
10
+
11
+ # Use `Array#join` instead of `Array#*`.
12
+ Style/ArrayJoin:
13
+ Enabled: true
14
+
15
+ # Use only ascii symbols in comments.
16
+ Style/AsciiComments:
17
+ Enabled: true
18
+
19
+ # Checks for uses of Module#attr.
20
+ Style/Attr:
21
+ Enabled: true
22
+
23
+ # Avoid the use of BEGIN blocks.
24
+ Style/BeginBlock:
25
+ Enabled: true
26
+
27
+ # Do not use block comments.
28
+ Style/BlockComments:
29
+ Enabled: true
30
+
31
+ # Avoid using {...} for multi-line blocks (multiline chaining is # always
32
+ # ugly). Prefer {...} over do...end for single-line blocks.
33
+ Style/BlockDelimiters:
34
+ Enabled: true
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
+ # This cop checks for uses of the case equality operator(===).
42
+ Style/CaseEquality:
43
+ Enabled: false
44
+
45
+ # Checks for uses of character literals.
46
+ Style/CharacterLiteral:
47
+ Enabled: true
48
+
49
+ # Checks style of children classes and modules.
50
+ Style/ClassAndModuleChildren:
51
+ Enabled: false
52
+
53
+ # Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
54
+ Style/ClassCheck:
55
+ Enabled: true
56
+
57
+ # Use self when defining module/class methods.
58
+ Style/ClassMethods:
59
+ Enabled: true
60
+
61
+ # Avoid the use of class variables.
62
+ Style/ClassVars:
63
+ Enabled: true
64
+
65
+ # This cop checks for methods invoked via the :: operator instead
66
+ # of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).
67
+ Style/ColonMethodCall:
68
+ Enabled: true
69
+
70
+ # This cop checks that comment annotation keywords are written according
71
+ # to guidelines.
72
+ Style/CommentAnnotation:
73
+ Enabled: false
74
+
75
+ # Check for `if` and `case` statements where each branch is used for
76
+ # assignment to the same variable when using the return of the
77
+ # condition can be used instead.
78
+ Style/ConditionalAssignment:
79
+ Enabled: true
80
+
81
+ # Use def with parentheses when there are arguments.
82
+ Style/DefWithParentheses:
83
+ Enabled: true
84
+
85
+ # Document classes and non-namespace modules.
86
+ Style/Documentation:
87
+ Enabled: false
88
+
89
+ # This cop checks for uses of double negation (!!) to convert something
90
+ # to a boolean value. As this is both cryptic and usually redundant, it
91
+ # should be avoided.
92
+ Style/DoubleNegation:
93
+ Enabled: false
94
+
95
+ # Avoid the use of END blocks.
96
+ Style/EndBlock:
97
+ Enabled: true
98
+
99
+ # Favor the use of Fixnum#even? && Fixnum#odd?
100
+ Style/EvenOdd:
101
+ Enabled: true
102
+
103
+ # Checks for flip flops.
104
+ Style/FlipFlop:
105
+ Enabled: true
106
+
107
+ # Checks use of for or each in multiline loops.
108
+ Style/For:
109
+ Enabled: true
110
+
111
+ # Use a consistent style for format string tokens.
112
+ Style/FormatStringToken:
113
+ Enabled: false
114
+
115
+ # Checks if there is a magic comment to enforce string literals
116
+ Style/FrozenStringLiteralComment:
117
+ Enabled: false
118
+
119
+ # Do not introduce global variables.
120
+ Style/GlobalVars:
121
+ Enabled: true
122
+ Exclude:
123
+ - 'lib/backup/**/*'
124
+ - 'lib/tasks/**/*'
125
+
126
+ # Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
127
+ # over 1.8 syntax `{ :a => 1, :b => 2 }`.
128
+ Style/HashSyntax:
129
+ Enabled: true
130
+
131
+ # Checks that conditional statements do not have an identical line at the
132
+ # end of each branch, which can validly be moved out of the conditional.
133
+ Style/IdenticalConditionalBranches:
134
+ Enabled: true
135
+
136
+ # Do not use if x; .... Use the ternary operator instead.
137
+ Style/IfWithSemicolon:
138
+ Enabled: true
139
+
140
+ # Use Kernel#loop for infinite loops.
141
+ Style/InfiniteLoop:
142
+ Enabled: true
143
+
144
+ # Use the inverse method instead of `!.method`
145
+ # if an inverse method is defined.
146
+ Style/InverseMethods:
147
+ Enabled: false
148
+
149
+ # Use lambda.call(...) instead of lambda.(...).
150
+ Style/LambdaCall:
151
+ Enabled: true
152
+
153
+ # Checks if the method definitions have or don't have parentheses.
154
+ Style/MethodDefParentheses:
155
+ Enabled: true
156
+
157
+ # Checks for usage of `extend self` in modules.
158
+ Style/ModuleFunction:
159
+ Enabled: false
160
+
161
+ # Avoid multi-line chains of blocks.
162
+ Style/MultilineBlockChain:
163
+ Enabled: true
164
+
165
+ # Do not use then for multi-line if/unless.
166
+ Style/MultilineIfThen:
167
+ Enabled: true
168
+
169
+ # Avoid multi-line `? :` (the ternary operator), use if/unless instead.
170
+ Style/MultilineTernaryOperator:
171
+ Enabled: true
172
+
173
+ # Avoid comparing a variable with multiple items in a conditional,
174
+ # use Array#include? instead.
175
+ Style/MultipleComparison:
176
+ Enabled: false
177
+
178
+ # This cop checks whether some constant value isn't a
179
+ # mutable literal (e.g. array or hash).
180
+ Style/MutableConstant:
181
+ Enabled: true
182
+ Exclude:
183
+ - 'db/migrate/**/*'
184
+ - 'db/post_migrate/**/*'
185
+ - 'db/geo/migrate/**/*'
186
+
187
+ # Favor unless over if for negative conditions (or control flow or).
188
+ Style/NegatedIf:
189
+ Enabled: true
190
+
191
+ # Avoid using nested modifiers.
192
+ Style/NestedModifier:
193
+ Enabled: true
194
+
195
+ # Use one expression per branch in a ternary operator.
196
+ Style/NestedTernaryOperator:
197
+ Enabled: true
198
+
199
+ # Prefer x.nil? to x == nil.
200
+ Style/NilComparison:
201
+ Enabled: true
202
+
203
+ # Checks for redundant nil checks.
204
+ Style/NonNilCheck:
205
+ Enabled: true
206
+
207
+ # Use ! instead of not.
208
+ Style/Not:
209
+ Enabled: true
210
+
211
+ # Add underscores to large numeric literals to improve their readability.
212
+ Style/NumericLiterals:
213
+ Enabled: false
214
+
215
+ # Favor the ternary operator(?:) over if/then/else/end constructs.
216
+ Style/OneLineConditional:
217
+ Enabled: true
218
+
219
+ # Don't use parentheses around the condition of an if/unless/while.
220
+ Style/ParenthesesAroundCondition:
221
+ Enabled: true
222
+
223
+ # This cop (by default) checks for uses of methods Hash#has_key? and
224
+ # Hash#has_value? where it enforces Hash#key? and Hash#value?
225
+ # It is configurable to enforce the inverse, using `verbose` method
226
+ # names also.
227
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
228
+ # SupportedStyles: short, verbose
229
+ Style/PreferredHashMethods:
230
+ Enabled: false
231
+
232
+ # Checks for an obsolete RuntimeException argument in raise/fail.
233
+ Style/RedundantException:
234
+ Enabled: true
235
+
236
+ # Checks for parentheses that seem not to serve any purpose.
237
+ Style/RedundantParentheses:
238
+ Enabled: true
239
+
240
+ # Don't use semicolons to terminate expressions.
241
+ Style/Semicolon:
242
+ Enabled: true
243
+
244
+ # Checks for proper usage of fail and raise.
245
+ Style/SignalException:
246
+ EnforcedStyle: only_raise
247
+ Enabled: true
248
+
249
+ # Check for the usage of parentheses around stabby lambda arguments.
250
+ Style/StabbyLambdaParentheses:
251
+ EnforcedStyle: require_parentheses
252
+ Enabled: true
253
+
254
+ # Checks if uses of quotes match the configured preference.
255
+ Style/StringLiterals:
256
+ Enabled: false
257
+
258
+ # Checks if configured preferred methods are used over non-preferred.
259
+ Style/StringMethods:
260
+ PreferredMethods:
261
+ intern: to_sym
262
+ Enabled: true
263
+
264
+ # Use %i or %I for arrays of symbols.
265
+ Style/SymbolArray:
266
+ Enabled: false
267
+
268
+ # This cop checks for trailing comma in array and hash literals.
269
+ Style/TrailingCommaInLiteral:
270
+ Enabled: true
271
+ EnforcedStyleForMultiline: no_comma
272
+
273
+ # This cop checks for trailing comma in argument lists.
274
+ Style/TrailingCommaInArguments:
275
+ Enabled: true
276
+ EnforcedStyleForMultiline: no_comma
277
+
278
+ # Checks for %W when interpolation is not needed.
279
+ Style/UnneededCapitalW:
280
+ Enabled: true
281
+
282
+ # Checks for %q/%Q when single quotes or double quotes would do.
283
+ Style/UnneededPercentQ:
284
+ Enabled: false
285
+
286
+ # Don't interpolate global, instance and class variables directly in strings.
287
+ Style/VariableInterpolation:
288
+ Enabled: true
289
+
290
+ # Use when x then ... for one-line cases.
291
+ Style/WhenThen:
292
+ Enabled: true
293
+
294
+ # Checks for redundant do after while or until.
295
+ Style/WhileUntilDo:
296
+ Enabled: true
297
+
298
+ # Favor modifier while/until usage when you have a single-line body.
299
+ Style/WhileUntilModifier:
300
+ Enabled: true
301
+
302
+ # Use %w or %W for arrays of words.
303
+ Style/WordArray:
304
+ Enabled: true
305
+
306
+ # Do not use literals as the first operand of a comparison.
307
+ Style/YodaCondition:
308
+ Enabled: false
309
+
310
+ # Use `proc` instead of `Proc.new`.
311
+ Style/Proc:
312
+ Enabled: true