gitlab-styles 0.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.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.gitlab-ci.yml +13 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +1 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +43 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/default.yml +1229 -0
  14. data/gitlab-styles.gemspec +29 -0
  15. data/lib/gitlab/styles.rb +6 -0
  16. data/lib/gitlab/styles/rubocop.rb +30 -0
  17. data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +30 -0
  18. data/lib/gitlab/styles/rubocop/cop/active_record_serialize.rb +22 -0
  19. data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +68 -0
  20. data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +41 -0
  21. data/lib/gitlab/styles/rubocop/cop/in_batches.rb +20 -0
  22. data/lib/gitlab/styles/rubocop/cop/migration/add_column.rb +56 -0
  23. data/lib/gitlab/styles/rubocop/cop/migration/add_column_with_default_to_large_table.rb +59 -0
  24. data/lib/gitlab/styles/rubocop/cop/migration/add_concurrent_foreign_key.rb +31 -0
  25. data/lib/gitlab/styles/rubocop/cop/migration/add_concurrent_index.rb +38 -0
  26. data/lib/gitlab/styles/rubocop/cop/migration/add_index.rb +52 -0
  27. data/lib/gitlab/styles/rubocop/cop/migration/add_timestamps.rb +29 -0
  28. data/lib/gitlab/styles/rubocop/cop/migration/datetime.rb +40 -0
  29. data/lib/gitlab/styles/rubocop/cop/migration/hash_index.rb +55 -0
  30. data/lib/gitlab/styles/rubocop/cop/migration/remove_concurrent_index.rb +33 -0
  31. data/lib/gitlab/styles/rubocop/cop/migration/remove_index.rb +30 -0
  32. data/lib/gitlab/styles/rubocop/cop/migration/reversible_add_column_with_default.rb +39 -0
  33. data/lib/gitlab/styles/rubocop/cop/migration/safer_boolean_column.rb +98 -0
  34. data/lib/gitlab/styles/rubocop/cop/migration/timestamps.rb +31 -0
  35. data/lib/gitlab/styles/rubocop/cop/migration/update_column_in_batches.rb +45 -0
  36. data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +27 -0
  37. data/lib/gitlab/styles/rubocop/cop/project_path_helper.rb +55 -0
  38. data/lib/gitlab/styles/rubocop/cop/redirect_with_status.rb +48 -0
  39. data/lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb +42 -0
  40. data/lib/gitlab/styles/rubocop/migration_helpers.rb +15 -0
  41. data/lib/gitlab/styles/rubocop/model_helpers.rb +15 -0
  42. data/lib/gitlab/styles/version.rb +5 -0
  43. metadata +169 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7a19ea1a58af0f1003976693c7a0a9d426819d12
4
+ data.tar.gz: '0963b84173710161b30e7d4606ca8c2947b61e47'
5
+ SHA512:
6
+ metadata.gz: 8043c785a50c1df883fc1d6f20a3a765e57a59e9d21c1454a3afacf5fa28befb823c53ebb01d24aaad97726436ea28dda5a53af6976cfa282b4611c5c6a02229
7
+ data.tar.gz: '09d9b3dc0d274b6536bdde93bf4efcded2a998a63033d2d37a9297b241d4a7e355eea421d5ed73a01a8d8991c460a40849fe2b5b4e2b4e0c5e89d37b315b1f04'
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
@@ -0,0 +1,13 @@
1
+ image: ruby:2.3
2
+
3
+ before_script:
4
+ - bundle --version
5
+ - bundle install
6
+
7
+ styles:
8
+ script:
9
+ - bundle exec rubocop
10
+
11
+ specs:
12
+ script:
13
+ - bundle exec rspec
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1 @@
1
+ inherit_from: default.yml
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at remy@rymai.me. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gitlab-rubocop.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Rémy Coutable
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Gitlab::Rubocop
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gitlab/rubocop`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'gitlab-rubocop'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gitlab-rubocop
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gitlab-rubocop. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Gitlab::Rubocop project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gitlab-rubocop/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gitlab/styles"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,1229 @@
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-gitlab-security
4
+ - ./lib/gitlab/styles/rubocop
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.3
8
+ TargetRailsVersion: 4.2
9
+ # Cop names are not d§splayed in offense messages by default. Change behavior
10
+ # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
11
+ # option.
12
+ DisplayCopNames: true
13
+ # Style guide URLs are not displayed in offense messages by default. Change
14
+ # behavior by overriding DisplayStyleGuide, or by giving the
15
+ # -S/--display-style-guide option.
16
+ DisplayStyleGuide: false
17
+ # Exclude some GitLab files
18
+ Exclude:
19
+ - 'vendor/**/*'
20
+ - 'node_modules/**/*'
21
+ - 'db/*'
22
+ - 'db/fixtures/**/*'
23
+ - 'db/geo/*'
24
+ - 'tmp/**/*'
25
+ - 'bin/**/*'
26
+ - 'generator_templates/**/*'
27
+ - 'builds/**/*'
28
+
29
+ # Gems in consecutive lines should be alphabetically sorted
30
+ Bundler/OrderedGems:
31
+ Enabled: false
32
+
33
+ # Layout ######################################################################
34
+
35
+ # Check indentation of private/protected visibility modifiers.
36
+ Layout/AccessModifierIndentation:
37
+ Enabled: true
38
+
39
+ # Align the elements of an array literal if they span more than one line.
40
+ Layout/AlignArray:
41
+ Enabled: true
42
+
43
+ # Align the elements of a hash literal if they span more than one line.
44
+ Layout/AlignHash:
45
+ Enabled: true
46
+
47
+ # Here we check if the parameters on a multi-line method call or
48
+ # definition are aligned.
49
+ Layout/AlignParameters:
50
+ Enabled: false
51
+
52
+ # Put end statement of multiline block on its own line.
53
+ Layout/BlockEndNewline:
54
+ Enabled: true
55
+
56
+ # Indentation of when in a case/when/[else/]end.
57
+ Layout/CaseIndentation:
58
+ Enabled: true
59
+
60
+ # Indentation of comments.
61
+ Layout/CommentIndentation:
62
+ Enabled: true
63
+
64
+ # Multi-line method chaining should be done with leading dots.
65
+ Layout/DotPosition:
66
+ Enabled: true
67
+ EnforcedStyle: leading
68
+
69
+ # Align elses and elsifs correctly.
70
+ Layout/ElseAlignment:
71
+ Enabled: true
72
+
73
+ # Add an empty line after magic comments to separate them from code.
74
+ Layout/EmptyLineAfterMagicComment:
75
+ Enabled: false
76
+
77
+ # Use empty lines between defs.
78
+ Layout/EmptyLineBetweenDefs:
79
+ Enabled: true
80
+
81
+ # Don't use several empty lines in a row.
82
+ Layout/EmptyLines:
83
+ Enabled: true
84
+
85
+ # Keep blank lines around access modifiers.
86
+ Layout/EmptyLinesAroundAccessModifier:
87
+ Enabled: true
88
+
89
+ # Keeps track of empty lines around block bodies.
90
+ Layout/EmptyLinesAroundBlockBody:
91
+ Enabled: true
92
+
93
+ # Keeps track of empty lines around class bodies.
94
+ Layout/EmptyLinesAroundClassBody:
95
+ Enabled: true
96
+
97
+ # Keeps track of empty lines around exception handling keywords.
98
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
99
+ Enabled: false
100
+
101
+ # Keeps track of empty lines around method bodies.
102
+ Layout/EmptyLinesAroundMethodBody:
103
+ Enabled: true
104
+
105
+ # Keeps track of empty lines around module bodies.
106
+ Layout/EmptyLinesAroundModuleBody:
107
+ Enabled: true
108
+
109
+ # Use Unix-style line endings.
110
+ Layout/EndOfLine:
111
+ Enabled: true
112
+
113
+ # Checks for a line break before the first parameter in a multi-line method
114
+ # parameter definition.
115
+ Layout/FirstMethodParameterLineBreak:
116
+ Enabled: true
117
+
118
+ # Keep indentation straight.
119
+ Layout/IndentationConsistency:
120
+ Enabled: true
121
+
122
+ # Use 2 spaces for indentation.
123
+ Layout/IndentationWidth:
124
+ Enabled: true
125
+
126
+ # Checks the indentation of the first line of the right-hand-side of a
127
+ # multi-line assignment.
128
+ Layout/IndentAssignment:
129
+ Enabled: true
130
+
131
+ # This cops checks the indentation of the here document bodies.
132
+ Layout/IndentHeredoc:
133
+ Enabled: false
134
+
135
+ # Comments should start with a space.
136
+ Layout/LeadingCommentSpace:
137
+ Enabled: true
138
+
139
+ # Checks that the closing brace in an array literal is either on the same line
140
+ # as the last array element, or a new line.
141
+ Layout/MultilineArrayBraceLayout:
142
+ Enabled: true
143
+ EnforcedStyle: symmetrical
144
+
145
+ # Ensures newlines after multiline block do statements.
146
+ Layout/MultilineBlockLayout:
147
+ Enabled: true
148
+
149
+ # Checks that the closing brace in a hash literal is either on the same line as
150
+ # the last hash element, or a new line.
151
+ Layout/MultilineHashBraceLayout:
152
+ Enabled: true
153
+ EnforcedStyle: symmetrical
154
+
155
+ # Checks that the closing brace in a method call is either on the same line as
156
+ # the last method argument, or a new line.
157
+ Layout/MultilineMethodCallBraceLayout:
158
+ Enabled: false
159
+ EnforcedStyle: symmetrical
160
+
161
+ # Checks indentation of method calls with the dot operator that span more than
162
+ # one line.
163
+ Layout/MultilineMethodCallIndentation:
164
+ Enabled: false
165
+
166
+ # Checks that the closing brace in a method definition is symmetrical with
167
+ # respect to the opening brace and the method parameters.
168
+ Layout/MultilineMethodDefinitionBraceLayout:
169
+ Enabled: false
170
+
171
+ # Checks indentation of binary operations that span more than one line.
172
+ Layout/MultilineOperationIndentation:
173
+ Enabled: true
174
+ EnforcedStyle: indented
175
+
176
+ # Use spaces after colons.
177
+ Layout/SpaceAfterColon:
178
+ Enabled: true
179
+
180
+ # Use spaces after commas.
181
+ Layout/SpaceAfterComma:
182
+ Enabled: true
183
+
184
+ # Do not put a space between a method name and the opening parenthesis in a
185
+ # method definition.
186
+ Layout/SpaceAfterMethodName:
187
+ Enabled: true
188
+
189
+ # Tracks redundant space after the ! operator.
190
+ Layout/SpaceAfterNot:
191
+ Enabled: true
192
+
193
+ # Use spaces after semicolons.
194
+ Layout/SpaceAfterSemicolon:
195
+ Enabled: true
196
+
197
+ # Use space around equals in parameter default
198
+ Layout/SpaceAroundEqualsInParameterDefault:
199
+ Enabled: true
200
+
201
+ # Use a space around keywords if appropriate.
202
+ Layout/SpaceAroundKeyword:
203
+ Enabled: true
204
+
205
+ # Use a single space around operators.
206
+ Layout/SpaceAroundOperators:
207
+ Enabled: true
208
+
209
+ # Checks that block braces have or don't have a space before the opening
210
+ # brace depending on configuration.
211
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
212
+ # SupportedStyles: space, no_space
213
+ Layout/SpaceBeforeBlockBraces:
214
+ Enabled: true
215
+
216
+ # No spaces before commas.
217
+ Layout/SpaceBeforeComma:
218
+ Enabled: true
219
+
220
+ # Checks for missing space between code and a comment on the same line.
221
+ Layout/SpaceBeforeComment:
222
+ Enabled: true
223
+
224
+ # No spaces before semicolons.
225
+ Layout/SpaceBeforeSemicolon:
226
+ Enabled: true
227
+
228
+ # Checks for spaces inside square brackets.
229
+ Layout/SpaceInsideBrackets:
230
+ Enabled: true
231
+
232
+ # Use spaces inside hash literal braces - or don't.
233
+ Layout/SpaceInsideHashLiteralBraces:
234
+ Enabled: true
235
+
236
+ # No spaces inside range literals.
237
+ Layout/SpaceInsideRangeLiteral:
238
+ Enabled: true
239
+
240
+ # Checks for padding/surrounding spaces inside string interpolation.
241
+ Layout/SpaceInsideStringInterpolation:
242
+ EnforcedStyle: no_space
243
+ Enabled: true
244
+
245
+ # No hard tabs.
246
+ Layout/Tab:
247
+ Enabled: true
248
+
249
+ # Checks trailing blank lines and final newline.
250
+ Layout/TrailingBlankLines:
251
+ Enabled: true
252
+
253
+ # Avoid trailing whitespace.
254
+ Layout/TrailingWhitespace:
255
+ Enabled: true
256
+
257
+ # Style #######################################################################
258
+
259
+ # Check the naming of accessor methods for get_/set_.
260
+ Style/AccessorMethodName:
261
+ Enabled: false
262
+
263
+ # Use alias_method instead of alias.
264
+ Style/Alias:
265
+ EnforcedStyle: prefer_alias_method
266
+ Enabled: true
267
+
268
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
269
+ # or completely (always).
270
+ Style/AndOr:
271
+ Enabled: true
272
+
273
+ # Use `Array#join` instead of `Array#*`.
274
+ Style/ArrayJoin:
275
+ Enabled: true
276
+
277
+ # Use only ascii symbols in comments.
278
+ Style/AsciiComments:
279
+ Enabled: true
280
+
281
+ # Use only ascii symbols in identifiers.
282
+ Style/AsciiIdentifiers:
283
+ Enabled: true
284
+
285
+ # Checks for uses of Module#attr.
286
+ Style/Attr:
287
+ Enabled: true
288
+
289
+ # Avoid the use of BEGIN blocks.
290
+ Style/BeginBlock:
291
+ Enabled: true
292
+
293
+ # Do not use block comments.
294
+ Style/BlockComments:
295
+ Enabled: true
296
+
297
+ # Avoid using {...} for multi-line blocks (multiline chaining is # always
298
+ # ugly). Prefer {...} over do...end for single-line blocks.
299
+ Style/BlockDelimiters:
300
+ Enabled: true
301
+
302
+ # This cop checks for braces around the last parameter in a method call
303
+ # if the last parameter is a hash.
304
+ Style/BracesAroundHashParameters:
305
+ Enabled: false
306
+
307
+ # This cop checks for uses of the case equality operator(===).
308
+ Style/CaseEquality:
309
+ Enabled: false
310
+
311
+ # Checks for uses of character literals.
312
+ Style/CharacterLiteral:
313
+ Enabled: true
314
+
315
+ # Use CamelCase for classes and modules.'
316
+ Style/ClassAndModuleCamelCase:
317
+ Enabled: true
318
+
319
+ # Checks style of children classes and modules.
320
+ Style/ClassAndModuleChildren:
321
+ Enabled: false
322
+
323
+ # Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
324
+ Style/ClassCheck:
325
+ Enabled: true
326
+
327
+ # Use self when defining module/class methods.
328
+ Style/ClassMethods:
329
+ Enabled: true
330
+
331
+ # Avoid the use of class variables.
332
+ Style/ClassVars:
333
+ Enabled: true
334
+
335
+ # This cop checks for methods invoked via the :: operator instead
336
+ # of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).
337
+ Style/ColonMethodCall:
338
+ Enabled: true
339
+
340
+ # This cop checks that comment annotation keywords are written according
341
+ # to guidelines.
342
+ Style/CommentAnnotation:
343
+ Enabled: false
344
+
345
+ # Check for `if` and `case` statements where each branch is used for
346
+ # assignment to the same variable when using the return of the
347
+ # condition can be used instead.
348
+ Style/ConditionalAssignment:
349
+ Enabled: true
350
+
351
+ # Constants should use SCREAMING_SNAKE_CASE.
352
+ Style/ConstantName:
353
+ Enabled: true
354
+
355
+ # Use def with parentheses when there are arguments.
356
+ Style/DefWithParentheses:
357
+ Enabled: true
358
+
359
+ # Document classes and non-namespace modules.
360
+ Style/Documentation:
361
+ Enabled: false
362
+
363
+ # This cop checks for uses of double negation (!!) to convert something
364
+ # to a boolean value. As this is both cryptic and usually redundant, it
365
+ # should be avoided.
366
+ Style/DoubleNegation:
367
+ Enabled: false
368
+
369
+ # Avoid the use of END blocks.
370
+ Style/EndBlock:
371
+ Enabled: true
372
+
373
+ # Favor the use of Fixnum#even? && Fixnum#odd?
374
+ Style/EvenOdd:
375
+ Enabled: true
376
+
377
+ # Use snake_case for source file names.
378
+ Style/FileName:
379
+ Enabled: true
380
+
381
+ # Checks for flip flops.
382
+ Style/FlipFlop:
383
+ Enabled: true
384
+
385
+ # Checks use of for or each in multiline loops.
386
+ Style/For:
387
+ Enabled: true
388
+
389
+ # Use a consistent style for format string tokens.
390
+ Style/FormatStringToken:
391
+ Enabled: false
392
+
393
+ # Checks if there is a magic comment to enforce string literals
394
+ Style/FrozenStringLiteralComment:
395
+ Enabled: false
396
+
397
+ # Do not introduce global variables.
398
+ Style/GlobalVars:
399
+ Enabled: true
400
+ Exclude:
401
+ - 'lib/backup/**/*'
402
+ - 'lib/tasks/**/*'
403
+
404
+ # Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
405
+ # over 1.8 syntax `{ :a => 1, :b => 2 }`.
406
+ Style/HashSyntax:
407
+ Enabled: true
408
+
409
+ # Checks that conditional statements do not have an identical line at the
410
+ # end of each branch, which can validly be moved out of the conditional.
411
+ Style/IdenticalConditionalBranches:
412
+ Enabled: true
413
+
414
+ # Do not use if x; .... Use the ternary operator instead.
415
+ Style/IfWithSemicolon:
416
+ Enabled: true
417
+
418
+ # Use Kernel#loop for infinite loops.
419
+ Style/InfiniteLoop:
420
+ Enabled: true
421
+
422
+ # Use the inverse method instead of `!.method`
423
+ # if an inverse method is defined.
424
+ Style/InverseMethods:
425
+ Enabled: false
426
+
427
+ # Use lambda.call(...) instead of lambda.(...).
428
+ Style/LambdaCall:
429
+ Enabled: true
430
+
431
+ # Checks if the method definitions have or don't have parentheses.
432
+ Style/MethodDefParentheses:
433
+ Enabled: true
434
+
435
+ # Use the configured style when naming methods.
436
+ Style/MethodName:
437
+ Enabled: true
438
+
439
+ # Checks for usage of `extend self` in modules.
440
+ Style/ModuleFunction:
441
+ Enabled: false
442
+
443
+ # Avoid multi-line chains of blocks.
444
+ Style/MultilineBlockChain:
445
+ Enabled: true
446
+
447
+ # Do not use then for multi-line if/unless.
448
+ Style/MultilineIfThen:
449
+ Enabled: true
450
+
451
+ # Avoid multi-line `? :` (the ternary operator), use if/unless instead.
452
+ Style/MultilineTernaryOperator:
453
+ Enabled: true
454
+
455
+ # Avoid comparing a variable with multiple items in a conditional,
456
+ # use Array#include? instead.
457
+ Style/MultipleComparison:
458
+ Enabled: false
459
+
460
+ # This cop checks whether some constant value isn't a
461
+ # mutable literal (e.g. array or hash).
462
+ Style/MutableConstant:
463
+ Enabled: true
464
+ Exclude:
465
+ - 'db/migrate/**/*'
466
+ - 'db/post_migrate/**/*'
467
+ - 'db/geo/migrate/**/*'
468
+
469
+ # Favor unless over if for negative conditions (or control flow or).
470
+ Style/NegatedIf:
471
+ Enabled: true
472
+
473
+ # Avoid using nested modifiers.
474
+ Style/NestedModifier:
475
+ Enabled: true
476
+
477
+ # Use one expression per branch in a ternary operator.
478
+ Style/NestedTernaryOperator:
479
+ Enabled: true
480
+
481
+ # Prefer x.nil? to x == nil.
482
+ Style/NilComparison:
483
+ Enabled: true
484
+
485
+ # Checks for redundant nil checks.
486
+ Style/NonNilCheck:
487
+ Enabled: true
488
+
489
+ # Use ! instead of not.
490
+ Style/Not:
491
+ Enabled: true
492
+
493
+ # Add underscores to large numeric literals to improve their readability.
494
+ Style/NumericLiterals:
495
+ Enabled: false
496
+
497
+ # Favor the ternary operator(?:) over if/then/else/end constructs.
498
+ Style/OneLineConditional:
499
+ Enabled: true
500
+
501
+ # When defining binary operators, name the argument other.
502
+ Naming/BinaryOperatorParameterName:
503
+ Enabled: true
504
+
505
+ # Don't use parentheses around the condition of an if/unless/while.
506
+ Style/ParenthesesAroundCondition:
507
+ Enabled: true
508
+
509
+ # This cop (by default) checks for uses of methods Hash#has_key? and
510
+ # Hash#has_value? where it enforces Hash#key? and Hash#value?
511
+ # It is configurable to enforce the inverse, using `verbose` method
512
+ # names also.
513
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
514
+ # SupportedStyles: short, verbose
515
+ Style/PreferredHashMethods:
516
+ Enabled: false
517
+
518
+ # Checks for an obsolete RuntimeException argument in raise/fail.
519
+ Style/RedundantException:
520
+ Enabled: true
521
+
522
+ # Checks for parentheses that seem not to serve any purpose.
523
+ Style/RedundantParentheses:
524
+ Enabled: true
525
+
526
+ # Don't use semicolons to terminate expressions.
527
+ Style/Semicolon:
528
+ Enabled: true
529
+
530
+ # Checks for proper usage of fail and raise.
531
+ Style/SignalException:
532
+ EnforcedStyle: only_raise
533
+ Enabled: true
534
+
535
+ # Check for the usage of parentheses around stabby lambda arguments.
536
+ Style/StabbyLambdaParentheses:
537
+ EnforcedStyle: require_parentheses
538
+ Enabled: true
539
+
540
+ # Checks if uses of quotes match the configured preference.
541
+ Style/StringLiterals:
542
+ Enabled: false
543
+
544
+ # Checks if configured preferred methods are used over non-preferred.
545
+ Style/StringMethods:
546
+ PreferredMethods:
547
+ intern: to_sym
548
+ Enabled: true
549
+
550
+ # Use %i or %I for arrays of symbols.
551
+ Style/SymbolArray:
552
+ Enabled: false
553
+
554
+ # This cop checks for trailing comma in array and hash literals.
555
+ Style/TrailingCommaInLiteral:
556
+ Enabled: true
557
+ EnforcedStyleForMultiline: no_comma
558
+
559
+ # This cop checks for trailing comma in argument lists.
560
+ Style/TrailingCommaInArguments:
561
+ Enabled: true
562
+ EnforcedStyleForMultiline: no_comma
563
+
564
+ # Checks for %W when interpolation is not needed.
565
+ Style/UnneededCapitalW:
566
+ Enabled: true
567
+
568
+ # Checks for %q/%Q when single quotes or double quotes would do.
569
+ Style/UnneededPercentQ:
570
+ Enabled: false
571
+
572
+ # Don't interpolate global, instance and class variables directly in strings.
573
+ Style/VariableInterpolation:
574
+ Enabled: true
575
+
576
+ # Use the configured style when naming variables.
577
+ Style/VariableName:
578
+ EnforcedStyle: snake_case
579
+ Enabled: true
580
+
581
+ # Use the configured style when numbering variables.
582
+ Style/VariableNumber:
583
+ Enabled: false
584
+
585
+ # Use when x then ... for one-line cases.
586
+ Style/WhenThen:
587
+ Enabled: true
588
+
589
+ # Checks for redundant do after while or until.
590
+ Style/WhileUntilDo:
591
+ Enabled: true
592
+
593
+ # Favor modifier while/until usage when you have a single-line body.
594
+ Style/WhileUntilModifier:
595
+ Enabled: true
596
+
597
+ # Use %w or %W for arrays of words.
598
+ Style/WordArray:
599
+ Enabled: true
600
+
601
+ # Do not use literals as the first operand of a comparison.
602
+ Style/YodaCondition:
603
+ Enabled: false
604
+
605
+ # Use `proc` instead of `Proc.new`.
606
+ Style/Proc:
607
+ Enabled: true
608
+
609
+ # Use `spam?` instead of `is_spam?`
610
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
611
+ # NamePrefix: is_, has_, have_
612
+ # NamePrefixBlacklist: is_, has_, have_
613
+ # NameWhitelist: is_a?
614
+ Style/PredicateName:
615
+ Enabled: true
616
+ NamePrefixBlacklist: is_
617
+ Exclude:
618
+ - 'spec/**/*'
619
+ - 'features/**/*'
620
+
621
+ # Metrics #####################################################################
622
+
623
+ # A calculated magnitude based on number of assignments,
624
+ # branches, and conditions.
625
+ Metrics/AbcSize:
626
+ Enabled: true
627
+ Max: 55.25
628
+
629
+ # This cop checks if the length of a block exceeds some maximum value.
630
+ Metrics/BlockLength:
631
+ Enabled: false
632
+
633
+ # Avoid excessive block nesting.
634
+ Metrics/BlockNesting:
635
+ Enabled: true
636
+ Max: 4
637
+
638
+ # Avoid classes longer than 100 lines of code.
639
+ Metrics/ClassLength:
640
+ Enabled: false
641
+
642
+ # A complexity metric that is strongly correlated to the number
643
+ # of test cases needed to validate a method.
644
+ Metrics/CyclomaticComplexity:
645
+ Enabled: true
646
+ Max: 13
647
+
648
+ # Limit lines to 80 characters.
649
+ Metrics/LineLength:
650
+ Enabled: false
651
+
652
+ # Avoid methods longer than 10 lines of code.
653
+ Metrics/MethodLength:
654
+ Enabled: false
655
+
656
+ # Avoid modules longer than 100 lines of code.
657
+ Metrics/ModuleLength:
658
+ Enabled: false
659
+
660
+ # Avoid parameter lists longer than three or four parameters.
661
+ Metrics/ParameterLists:
662
+ Enabled: true
663
+ Max: 8
664
+
665
+ # A complexity metric geared towards measuring complexity for a human reader.
666
+ Metrics/PerceivedComplexity:
667
+ Enabled: true
668
+ Max: 15
669
+
670
+ # Lint ########################################################################
671
+
672
+ # Checks for ambiguous block association with method when param passed without
673
+ # parentheses.
674
+ Lint/AmbiguousBlockAssociation:
675
+ Enabled: false
676
+
677
+ # Checks for ambiguous operators in the first argument of a method invocation
678
+ # without parentheses.
679
+ Lint/AmbiguousOperator:
680
+ Enabled: true
681
+
682
+ # This cop checks for ambiguous regexp literals in the first argument of
683
+ # a method invocation without parentheses.
684
+ Lint/AmbiguousRegexpLiteral:
685
+ Enabled: false
686
+
687
+ # This cop checks for assignments in the conditions of
688
+ # if/while/until.
689
+ Lint/AssignmentInCondition:
690
+ Enabled: false
691
+
692
+ # Align block ends correctly.
693
+ Lint/BlockAlignment:
694
+ Enabled: true
695
+
696
+ # Default values in optional keyword arguments and optional ordinal arguments
697
+ # should not refer back to the name of the argument.
698
+ Lint/CircularArgumentReference:
699
+ Enabled: true
700
+
701
+ # Checks for condition placed in a confusing position relative to the keyword.
702
+ Lint/ConditionPosition:
703
+ Enabled: true
704
+
705
+ # Check for debugger calls.
706
+ Lint/Debugger:
707
+ Enabled: true
708
+
709
+ # Align ends corresponding to defs correctly.
710
+ Lint/DefEndAlignment:
711
+ Enabled: true
712
+
713
+ # Check for deprecated class method calls.
714
+ Lint/DeprecatedClassMethods:
715
+ Enabled: true
716
+
717
+ # Check for immutable argument given to each_with_object.
718
+ Lint/EachWithObjectArgument:
719
+ Enabled: true
720
+
721
+ # Check for odd code arrangement in an else block.
722
+ Lint/ElseLayout:
723
+ Enabled: true
724
+
725
+ # Checks for empty ensure block.
726
+ Lint/EmptyEnsure:
727
+ Enabled: true
728
+
729
+ # Checks for the presence of `when` branches without a body.
730
+ Lint/EmptyWhen:
731
+ Enabled: true
732
+
733
+ # Align ends correctly.
734
+ Lint/EndAlignment:
735
+ Enabled: true
736
+
737
+ # END blocks should not be placed inside method definitions.
738
+ Lint/EndInMethod:
739
+ Enabled: true
740
+
741
+ # Do not use return in an ensure block.
742
+ Lint/EnsureReturn:
743
+ Enabled: true
744
+
745
+ # Catches floating-point literals too large or small for Ruby to represent.
746
+ Lint/FloatOutOfRange:
747
+ Enabled: true
748
+
749
+ # The number of parameters to format/sprint must match the fields.
750
+ Lint/FormatParameterMismatch:
751
+ Enabled: true
752
+
753
+ # This cop checks for *rescue* blocks with no body.
754
+ Lint/HandleExceptions:
755
+ Enabled: false
756
+
757
+ # Checks for adjacent string literals on the same line, which could better be
758
+ # represented as a single string literal.
759
+ Lint/ImplicitStringConcatenation:
760
+ Enabled: true
761
+
762
+ # Checks for attempts to use `private` or `protected` to set the visibility
763
+ # of a class method, which does not work.
764
+ Lint/IneffectiveAccessModifier:
765
+ Enabled: false
766
+
767
+ # Checks for invalid character literals with a non-escaped whitespace
768
+ # character.
769
+ Lint/InvalidCharacterLiteral:
770
+ Enabled: true
771
+
772
+ # Checks of literals used in conditions.
773
+ Lint/LiteralInCondition:
774
+ Enabled: true
775
+
776
+ # Checks for literals used in interpolation.
777
+ Lint/LiteralInInterpolation:
778
+ Enabled: true
779
+
780
+ # This cop checks for uses of *begin...end while/until something*.
781
+ Lint/Loop:
782
+ Enabled: false
783
+
784
+ # Do not use nested method definitions.
785
+ Lint/NestedMethodDefinition:
786
+ Enabled: true
787
+
788
+ # Do not omit the accumulator when calling `next` in a `reduce`/`inject` block.
789
+ Lint/NextWithoutAccumulator:
790
+ Enabled: true
791
+
792
+ # Checks for method calls with a space before the opening parenthesis.
793
+ Lint/ParenthesesAsGroupedExpression:
794
+ Enabled: true
795
+
796
+ # Checks for `rand(1)` calls. Such calls always return `0` and most likely
797
+ # a mistake.
798
+ Lint/RandOne:
799
+ Enabled: true
800
+
801
+ # Use parentheses in the method call to avoid confusion about precedence.
802
+ Lint/RequireParentheses:
803
+ Enabled: true
804
+
805
+ # Avoid rescuing the Exception class.
806
+ Lint/RescueException:
807
+ Enabled: true
808
+
809
+ # Checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception.
810
+ Lint/ShadowedException:
811
+ Enabled: false
812
+
813
+ # This cop looks for use of the same name as outer local variables
814
+ # for block arguments or block local variables.
815
+ Lint/ShadowingOuterLocalVariable:
816
+ Enabled: false
817
+
818
+ # Checks for Object#to_s usage in string interpolation.
819
+ Lint/StringConversionInInterpolation:
820
+ Enabled: true
821
+
822
+ # Do not use prefix `_` for a variable that is used.
823
+ Lint/UnderscorePrefixedVariableName:
824
+ Enabled: true
825
+
826
+ # This cop checks for using Fixnum or Bignum constant
827
+ Lint/UnifiedInteger:
828
+ Enabled: true
829
+
830
+ # Checks for rubocop:disable comments that can be removed.
831
+ # Note: this cop is not disabled when disabling all cops.
832
+ # It must be explicitly disabled.
833
+ Lint/UnneededDisable:
834
+ Enabled: false
835
+
836
+ # This cop checks for unneeded usages of splat expansion
837
+ Lint/UnneededSplatExpansion:
838
+ Enabled: false
839
+
840
+ # Unreachable code.
841
+ Lint/UnreachableCode:
842
+ Enabled: true
843
+
844
+ # This cop checks for unused block arguments.
845
+ Lint/UnusedBlockArgument:
846
+ Enabled: false
847
+
848
+ # This cop checks for unused method arguments.
849
+ Lint/UnusedMethodArgument:
850
+ Enabled: false
851
+
852
+ # Checks for useless access modifiers.
853
+ Lint/UselessAccessModifier:
854
+ Enabled: true
855
+
856
+ # Checks for useless assignment to a local variable.
857
+ Lint/UselessAssignment:
858
+ Enabled: true
859
+
860
+ # Checks for comparison of something with itself.
861
+ Lint/UselessComparison:
862
+ Enabled: true
863
+
864
+ # Checks for useless `else` in `begin..end` without `rescue`.
865
+ Lint/UselessElseWithoutRescue:
866
+ Enabled: true
867
+
868
+ # Checks for useless setter call to a local variable.
869
+ Lint/UselessSetterCall:
870
+ Enabled: true
871
+
872
+ # Possible use of operator/literal/variable in void context.
873
+ Lint/Void:
874
+ Enabled: true
875
+
876
+ # Performance #################################################################
877
+
878
+ # Use `caller(n..n)` instead of `caller`.
879
+ Performance/Caller:
880
+ Enabled: false
881
+
882
+ # Use `casecmp` rather than `downcase ==`.
883
+ Performance/Casecmp:
884
+ Enabled: true
885
+
886
+ # Use `str.{start,end}_with?(x, ..., y, ...)` instead of
887
+ # `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
888
+ Performance/DoubleStartEndWith:
889
+ Enabled: true
890
+
891
+ # Use `strip` instead of `lstrip.rstrip`.
892
+ Performance/LstripRstrip:
893
+ Enabled: true
894
+
895
+ # Use `Range#cover?` instead of `Range#include?`.
896
+ Performance/RangeInclude:
897
+ Enabled: true
898
+
899
+ # This cop identifies the use of a `&block` parameter and `block.call`
900
+ # where `yield` would do just as well.
901
+ Performance/RedundantBlockCall:
902
+ Enabled: true
903
+
904
+ # This cop identifies use of `Regexp#match` or `String#match in a context
905
+ # where the integral return value of `=~` would do just as well.
906
+ Performance/RedundantMatch:
907
+ Enabled: true
908
+
909
+ # This cop identifies places where `Hash#merge!` can be replaced by
910
+ # `Hash#[]=`.
911
+ Performance/RedundantMerge:
912
+ Enabled: true
913
+ MaxKeyValuePairs: 1
914
+
915
+ # Use `sort` instead of `sort_by { |x| x }`.
916
+ Performance/RedundantSortBy:
917
+ Enabled: true
918
+
919
+ # Use `start_with?` instead of a regex match anchored to the beginning of a
920
+ # string.
921
+ Performance/StartWith:
922
+ Enabled: true
923
+
924
+ # Use `tr` instead of `gsub` when you are replacing the same number of
925
+ # characters. Use `delete` instead of `gsub` when you are deleting
926
+ # characters.
927
+ Performance/StringReplacement:
928
+ Enabled: true
929
+
930
+ # Checks for `.times.map` calls.
931
+ Performance/TimesMap:
932
+ Enabled: true
933
+
934
+ # Security ####################################################################
935
+
936
+ # This cop checks for the use of JSON class methods which have potential
937
+ # security issues.
938
+ Security/JSONLoad:
939
+ Enabled: true
940
+
941
+ # This cop checks for the use of *Kernel#eval*.
942
+ Security/Eval:
943
+ Enabled: true
944
+
945
+ # Rails #######################################################################
946
+
947
+ # Enables Rails cops.
948
+ Rails:
949
+ Enabled: true
950
+
951
+ # Enforces consistent use of action filter methods.
952
+ Rails/ActionFilter:
953
+ Enabled: true
954
+ EnforcedStyle: action
955
+
956
+ # Check that models subclass ApplicationRecord.
957
+ Rails/ApplicationRecord:
958
+ Enabled: false
959
+
960
+ # Enforce using `blank?` and `present?`.
961
+ Rails/Blank:
962
+ Enabled: false
963
+
964
+ # Checks the correct usage of date aware methods, such as `Date.today`,
965
+ # `Date.current`, etc.
966
+ Rails/Date:
967
+ Enabled: false
968
+
969
+ # Prefer delegate method for delegations.
970
+ # Disabled per https://gitlab.com/gitlab-org/gitlab-ce/issues/35869
971
+ Rails/Delegate:
972
+ Enabled: false
973
+
974
+ # This cop checks dynamic `find_by_*` methods.
975
+ Rails/DynamicFindBy:
976
+ Enabled: false
977
+
978
+ # This cop enforces that 'exit' calls are not used within a rails app.
979
+ Rails/Exit:
980
+ Enabled: true
981
+ Exclude:
982
+ - lib/gitlab/upgrader.rb
983
+ - 'lib/backup/**/*'
984
+
985
+ # Prefer `find_by` over `where.first`.
986
+ Rails/FindBy:
987
+ Enabled: true
988
+
989
+ # Prefer `all.find_each` over `all.find`.
990
+ Rails/FindEach:
991
+ Enabled: true
992
+
993
+ # Prefer has_many :through to has_and_belongs_to_many.
994
+ Rails/HasAndBelongsToMany:
995
+ Enabled: true
996
+
997
+ # This cop is used to identify usages of http methods like `get`, `post`,
998
+ # `put`, `patch` without the usage of keyword arguments in your tests and
999
+ # change them to use keyword args.
1000
+ Rails/HttpPositionalArguments:
1001
+ Enabled: false
1002
+
1003
+ # Checks for calls to puts, print, etc.
1004
+ Rails/Output:
1005
+ Enabled: true
1006
+ Exclude:
1007
+ - lib/gitlab/seeder.rb
1008
+ - lib/gitlab/upgrader.rb
1009
+ - 'lib/backup/**/*'
1010
+ - 'lib/tasks/**/*'
1011
+
1012
+ # This cop checks for the use of output safety calls like html_safe and
1013
+ # raw.
1014
+ Rails/OutputSafety:
1015
+ Enabled: false
1016
+
1017
+ # Checks for incorrect grammar when using methods like `3.day.ago`.
1018
+ Rails/PluralizationGrammar:
1019
+ Enabled: true
1020
+
1021
+ # Enforce using `blank?` and `present?`.
1022
+ Rails/Present:
1023
+ Enabled: false
1024
+
1025
+ # Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
1026
+ Rails/ReadWriteAttribute:
1027
+ Enabled: false
1028
+
1029
+ # Do not assign relative date to constants.
1030
+ Rails/RelativeDateConstant:
1031
+ Enabled: false
1032
+
1033
+ # Checks the arguments of ActiveRecord scopes.
1034
+ Rails/ScopeArgs:
1035
+ Enabled: true
1036
+
1037
+ # This cop checks for the use of Time methods without zone.
1038
+ Rails/TimeZone:
1039
+ Enabled: false
1040
+
1041
+ # This cop checks for the use of old-style attribute validation macros.
1042
+ Rails/Validation:
1043
+ Enabled: true
1044
+
1045
+ # RSpec #######################################################################
1046
+
1047
+ # Check that instances are not being stubbed globally.
1048
+ RSpec/AnyInstance:
1049
+ Enabled: false
1050
+
1051
+ # Check for expectations where `be(...)` can replace `eql(...)`.
1052
+ RSpec/BeEql:
1053
+ Enabled: true
1054
+
1055
+ # We don't enforce this as we use this technique in a few places.
1056
+ RSpec/BeforeAfterAll:
1057
+ Enabled: false
1058
+
1059
+ # Check that the first argument to the top level describe is the tested class or
1060
+ # module.
1061
+ RSpec/DescribeClass:
1062
+ Enabled: false
1063
+
1064
+ # Checks that the second argument to `describe` specifies a method.
1065
+ RSpec/DescribeMethod:
1066
+ Enabled: false
1067
+
1068
+ # Avoid describing symbols.
1069
+ RSpec/DescribeSymbol:
1070
+ Enabled: true
1071
+
1072
+ # Checks that tests use `described_class`.
1073
+ RSpec/DescribedClass:
1074
+ Enabled: true
1075
+
1076
+ # Checks if an example group does not include any tests.
1077
+ RSpec/EmptyExampleGroup:
1078
+ Enabled: true
1079
+ CustomIncludeMethods:
1080
+ - run_permission_checks
1081
+ - run_group_permission_checks
1082
+ - it_should_email!
1083
+ - it_should_not_email!
1084
+
1085
+ # Checks for long example.
1086
+ RSpec/ExampleLength:
1087
+ Enabled: false
1088
+ Max: 5
1089
+
1090
+ # Do not use should when describing your tests.
1091
+ RSpec/ExampleWording:
1092
+ Enabled: false
1093
+ CustomTransform:
1094
+ be: is
1095
+ have: has
1096
+ not: does not
1097
+ IgnoredWords: []
1098
+
1099
+ # Checks for `expect(...)` calls containing literal values.
1100
+ RSpec/ExpectActual:
1101
+ Enabled: true
1102
+
1103
+ # Checks for opportunities to use `expect { … }.to output`.
1104
+ RSpec/ExpectOutput:
1105
+ Enabled: true
1106
+
1107
+ # Checks the file and folder naming of the spec file.
1108
+ RSpec/FilePath:
1109
+ Enabled: true
1110
+ IgnoreMethods: true
1111
+ Exclude:
1112
+ - 'qa/**/*'
1113
+ - 'spec/javascripts/fixtures/*'
1114
+ - 'spec/requests/api/v3/*'
1115
+
1116
+ # Checks if there are focused specs.
1117
+ RSpec/Focus:
1118
+ Enabled: true
1119
+
1120
+ # Checks the arguments passed to `before`, `around`, and `after`.
1121
+ RSpec/HookArgument:
1122
+ Enabled: true
1123
+ EnforcedStyle: implicit
1124
+
1125
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
1126
+ # SupportedStyles: is_expected, should
1127
+ RSpec/ImplicitExpect:
1128
+ Enabled: true
1129
+ EnforcedStyle: is_expected
1130
+
1131
+ # Checks for the usage of instance variables.
1132
+ RSpec/InstanceVariable:
1133
+ Enabled: false
1134
+
1135
+ # Checks for `subject` definitions that come after `let` definitions.
1136
+ RSpec/LeadingSubject:
1137
+ Enabled: false
1138
+
1139
+ # Checks unreferenced `let!` calls being used for test setup.
1140
+ RSpec/LetSetup:
1141
+ Enabled: false
1142
+
1143
+ # Check that chains of messages are not being stubbed.
1144
+ RSpec/MessageChain:
1145
+ Enabled: false
1146
+
1147
+ # Checks that message expectations are set using spies.
1148
+ RSpec/MessageSpies:
1149
+ Enabled: false
1150
+
1151
+ # Checks for multiple top-level describes.
1152
+ RSpec/MultipleDescribes:
1153
+ Enabled: false
1154
+
1155
+ # Checks if examples contain too many `expect` calls.
1156
+ RSpec/MultipleExpectations:
1157
+ Enabled: false
1158
+
1159
+ # Checks for explicitly referenced test subjects.
1160
+ RSpec/NamedSubject:
1161
+ Enabled: false
1162
+
1163
+ # Checks for nested example groups.
1164
+ RSpec/NestedGroups:
1165
+ Enabled: false
1166
+
1167
+ # Enforces the usage of the same method on all negative message expectations.
1168
+ RSpec/NotToNot:
1169
+ EnforcedStyle: not_to
1170
+ Enabled: true
1171
+
1172
+ # Check for repeated description strings in example groups.
1173
+ RSpec/RepeatedDescription:
1174
+ Enabled: false
1175
+
1176
+ # Ensure RSpec hook blocks are always multi-line.
1177
+ RSpec/SingleLineHook:
1178
+ Enabled: true
1179
+ Exclude:
1180
+ - 'spec/factories/*'
1181
+ - 'spec/requests/api/v3/*'
1182
+
1183
+ # Checks for stubbed test subjects.
1184
+ RSpec/SubjectStub:
1185
+ Enabled: false
1186
+
1187
+ # Prefer using verifying doubles over normal doubles.
1188
+ RSpec/VerifiedDoubles:
1189
+ Enabled: false
1190
+
1191
+ # GitlabSecurity ##############################################################
1192
+
1193
+ GitlabSecurity/DeepMunge:
1194
+ Enabled: true
1195
+ Exclude:
1196
+ - 'lib/**/*.rake'
1197
+ - 'spec/**/*'
1198
+
1199
+ # To be enabled by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13610
1200
+ GitlabSecurity/JsonSerialization:
1201
+ Enabled: false
1202
+
1203
+ GitlabSecurity/PublicSend:
1204
+ Enabled: true
1205
+ Exclude:
1206
+ - 'config/**/*'
1207
+ - 'db/**/*'
1208
+ - 'features/**/*'
1209
+ - 'lib/**/*.rake'
1210
+ - 'qa/**/*'
1211
+ - 'spec/**/*'
1212
+
1213
+ GitlabSecurity/RedirectToParamsUpdate:
1214
+ Enabled: true
1215
+ Exclude:
1216
+ - 'lib/**/*.rake'
1217
+ - 'spec/**/*'
1218
+
1219
+ GitlabSecurity/SqlInjection:
1220
+ Enabled: true
1221
+ Exclude:
1222
+ - 'lib/**/*.rake'
1223
+ - 'spec/**/*'
1224
+
1225
+ GitlabSecurity/SystemCommandInjection:
1226
+ Enabled: true
1227
+ Exclude:
1228
+ - 'lib/**/*.rake'
1229
+ - 'spec/**/*'