gitlab-styles 4.2.0 → 5.3.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +18 -0
  3. data/.gitlab-ci.yml +5 -16
  4. data/.gitlab/merge_request_templates/New Static Analysis Check.md +21 -0
  5. data/.gitlab/merge_request_templates/Release.md +4 -4
  6. data/.rubocop.yml +3 -1
  7. data/Gemfile +2 -2
  8. data/gitlab-styles.gemspec +6 -5
  9. data/lib/gitlab/styles/rubocop.rb +3 -14
  10. data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +1 -1
  11. data/lib/gitlab/styles/rubocop/cop/code_reuse/active_record.rb +131 -0
  12. data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +6 -3
  13. data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +1 -1
  14. data/lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb +1 -1
  15. data/lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb +132 -0
  16. data/lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb +1 -1
  17. data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +1 -1
  18. data/lib/gitlab/styles/rubocop/cop/rspec/base.rb +18 -0
  19. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb +65 -0
  20. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb +6 -6
  21. data/lib/gitlab/styles/rubocop/cop/rspec/example_starting_character.rb +124 -0
  22. data/lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb +10 -5
  23. data/lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb +3 -2
  24. data/lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb +10 -13
  25. data/lib/gitlab/styles/rubocop/model_helpers.rb +1 -1
  26. data/lib/gitlab/styles/rubocop/rspec/helpers.rb +17 -0
  27. data/lib/gitlab/styles/version.rb +1 -1
  28. data/rubocop-all.yml +1 -0
  29. data/rubocop-bundler.yml +1 -0
  30. data/rubocop-code_reuse.yml +24 -0
  31. data/rubocop-default.yml +1 -0
  32. data/rubocop-gemspec.yml +1 -0
  33. data/rubocop-layout.yml +6 -0
  34. data/rubocop-lint.yml +63 -5
  35. data/rubocop-metrics.yml +1 -0
  36. data/rubocop-migrations.yml +1 -0
  37. data/rubocop-naming.yml +1 -0
  38. data/rubocop-performance.yml +48 -0
  39. data/rubocop-rails.yml +79 -0
  40. data/rubocop-rspec.yml +10 -0
  41. data/rubocop-security.yml +1 -0
  42. data/rubocop-style.yml +91 -1
  43. metadata +23 -15
  44. data/.rubocop_todo.yml +0 -7
@@ -1,3 +1,4 @@
1
+ ---
1
2
  require:
2
3
  - rubocop-gitlab-security
3
4
  - rubocop-performance
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Dependencies in the gemspec should be alphabetically sorted
2
3
  # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
3
4
  Gemspec/OrderedDependencies:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Check indentation of private/protected visibility modifiers.
2
3
  Layout/AccessModifierIndentation:
3
4
  Enabled: true
@@ -60,6 +61,11 @@ Layout/EmptyLines:
60
61
  Layout/EmptyLinesAroundAccessModifier:
61
62
  Enabled: true
62
63
 
64
+ # Checks for a newline after an attribute accessor or a group of them
65
+ # https://docs.rubocop.org/rubocop/0.89/cops_layout.html#layoutemptylinesaroundattributeaccessor
66
+ Layout/EmptyLinesAroundAttributeAccessor:
67
+ Enabled: true
68
+
63
69
  # Keeps track of empty lines around block bodies.
64
70
  Layout/EmptyLinesAroundBlockBody:
65
71
  Enabled: true
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Checks for ambiguous block association with method when param passed without
2
3
  # parentheses.
3
4
  Lint/AmbiguousBlockAssociation:
@@ -18,6 +19,10 @@ Lint/AmbiguousRegexpLiteral:
18
19
  Lint/AssignmentInCondition:
19
20
  Enabled: false
20
21
 
22
+ # Checks for places where binary operator has identical operands
23
+ Lint/BinaryOperatorWithIdenticalOperands:
24
+ Enabled: true
25
+
21
26
  # Default values in optional keyword arguments and optional ordinal arguments
22
27
  # should not refer back to the name of the argument.
23
28
  Lint/CircularArgumentReference:
@@ -31,6 +36,22 @@ Lint/Debugger:
31
36
  Lint/DeprecatedClassMethods:
32
37
  Enabled: true
33
38
 
39
+ # Algorithmic constants for OpenSSL::Cipher and OpenSSL::Digest deprecated since OpenSSL version 2.2.0.
40
+ # Prefer passing a string instead.
41
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintdeprecatedopensslconstant
42
+ Lint/DeprecatedOpenSSLConstant:
43
+ Enabled: true
44
+
45
+ # Checks that there are no repeated conditions used in if 'elsif'.
46
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintduplicateelsifcondition
47
+ Lint/DuplicateElsifCondition:
48
+ Enabled: true
49
+
50
+ # Checks that there are no repeated exceptions used in 'rescue' expressions.
51
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintduplicaterescueexception
52
+ Lint/DuplicateRescueException:
53
+ Enabled: true
54
+
34
55
  # Check for immutable argument given to each_with_object.
35
56
  Lint/EachWithObjectArgument:
36
57
  Enabled: true
@@ -39,6 +60,11 @@ Lint/EachWithObjectArgument:
39
60
  Lint/ElseLayout:
40
61
  Enabled: true
41
62
 
63
+ # Checks for the presence of if, elsif and unless branches without a body.
64
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintemptyconditionalbody
65
+ Lint/EmptyConditionalBody:
66
+ Enabled: true
67
+
42
68
  # Checks for empty ensure block.
43
69
  Lint/EmptyEnsure:
44
70
  Enabled: true
@@ -55,6 +81,11 @@ Lint/EnsureReturn:
55
81
  Lint/FlipFlop:
56
82
  Enabled: true
57
83
 
84
+ # Checks for the presence of precise comparison of floating point numbers.
85
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintfloatcomparison
86
+ Lint/FloatComparison:
87
+ Enabled: true
88
+
58
89
  # Catches floating-point literals too large or small for Ruby to represent.
59
90
  Lint/FloatOutOfRange:
60
91
  Enabled: true
@@ -81,10 +112,21 @@ Lint/LiteralAsCondition:
81
112
  Lint/LiteralInInterpolation:
82
113
  Enabled: true
83
114
 
84
- # This cop checks for uses of *begin...end while/until something*.
115
+ # Checks for uses of *begin...end while/until something*.
85
116
  Lint/Loop:
86
117
  Enabled: false
87
118
 
119
+ # Checks for the presence of constructors and lifecycle callbacks without calls to super.
120
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintmissingsuper
121
+ Lint/MissingSuper:
122
+ Enabled: false
123
+
124
+ # Do not mix named captures and numbered captures in a Regexp literal
125
+ # because numbered capture is ignored if they’re mixed.
126
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintmixedregexpcapturetypes
127
+ Lint/MixedRegexpCaptureTypes:
128
+ Enabled: true
129
+
88
130
  # Do not use nested method definitions.
89
131
  Lint/NestedMethodDefinition:
90
132
  Enabled: true
@@ -93,6 +135,11 @@ Lint/NestedMethodDefinition:
93
135
  Lint/NextWithoutAccumulator:
94
136
  Enabled: true
95
137
 
138
+ # Looks for references of Regexp captures that are out of range and thus always returns nil.
139
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintoutofrangeregexpref
140
+ Lint/OutOfRangeRegexpRef:
141
+ Enabled: true
142
+
96
143
  # Checks for method calls with a space before the opening parenthesis.
97
144
  Lint/ParenthesesAsGroupedExpression:
98
145
  Enabled: true
@@ -126,6 +173,11 @@ Lint/RescueException:
126
173
  Lint/SafeNavigationWithEmpty:
127
174
  Enabled: true
128
175
 
176
+ # Checks for self-assignments.
177
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintselfassignment
178
+ Lint/SelfAssignment:
179
+ Enabled: true
180
+
129
181
  # Checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception.
130
182
  Lint/ShadowedException:
131
183
  Enabled: false
@@ -143,6 +195,11 @@ Lint/StructNewOverride:
143
195
  Lint/SuppressedException:
144
196
  Enabled: false
145
197
 
198
+ # Checks for top level return with arguments.
199
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#linttoplevelreturnwithargument
200
+ Lint/TopLevelReturnWithArgument:
201
+ Enabled: true
202
+
146
203
  # Do not use prefix `_` for a variable that is used.
147
204
  Lint/UnderscorePrefixedVariableName:
148
205
  Enabled: true
@@ -155,6 +212,11 @@ Lint/UnifiedInteger:
155
212
  Lint/UnreachableCode:
156
213
  Enabled: true
157
214
 
215
+ # Checks for loops that will have at most one iteration.
216
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintunreachableloop
217
+ Lint/UnreachableLoop:
218
+ Enabled: true
219
+
158
220
  # This cop checks for unused block arguments.
159
221
  Lint/UnusedBlockArgument:
160
222
  Enabled: false
@@ -172,10 +234,6 @@ Lint/UselessAccessModifier:
172
234
  Lint/UselessAssignment:
173
235
  Enabled: true
174
236
 
175
- # Checks for comparison of something with itself.
176
- Lint/UselessComparison:
177
- Enabled: true
178
-
179
237
  # Checks for useless `else` in `begin..end` without `rescue`.
180
238
  Lint/UselessElseWithoutRescue:
181
239
  Enabled: true
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # A calculated magnitude based on number of assignments,
2
3
  # branches, and conditions.
3
4
  Metrics/AbcSize:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Checks for methods that may lead to batch type issues on a table that's been
2
3
  # explicitly denied because of its size.
3
4
  #
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Check the naming of accessor methods for get_/set_.
2
3
  Naming/AccessorMethodName:
3
4
  Enabled: false
@@ -1,3 +1,15 @@
1
+ ---
2
+ # Used to identify usages of ancestors.include? and change them to use ⇐ instead.
3
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performanceancestorsinclude
4
+ Performance/AncestorsInclude:
5
+ Enabled: true
6
+
7
+ # Identifies places where numeric argument to BigDecimal should be converted to string.
8
+ # Initializing from String is faster than from Numeric for BigDecimal.
9
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancebigdecimalwithnumericargument
10
+ Performance/BigDecimalWithNumericArgument:
11
+ Enabled: true
12
+
1
13
  # Use `caller(n..n)` instead of `caller`.
2
14
  Performance/Caller:
3
15
  Enabled: false
@@ -31,17 +43,53 @@ Performance/RedundantMerge:
31
43
  Enabled: true
32
44
  MaxKeyValuePairs: 1
33
45
 
46
+ # Identifies places where sort { |a, b| a <=> b } can be replaced with sort.
47
+ # https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performanceredundantsortblock
48
+ Performance/RedundantSortBlock:
49
+ Enabled: true
50
+
51
+ # Checks for redundant String#chars.
52
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performanceredundantstringchars
53
+ Performance/RedundantStringChars:
54
+ Enabled: true
55
+
56
+ # Identifies places where reverse.first(n) and reverse.first can be replaced by last(n).reverse and last.
57
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancereversefirst
58
+ Performance/ReverseFirst:
59
+ Enabled: true
60
+
61
+ # Identifies places where sort { |a, b| b <=> a } can be replaced by a faster sort.reverse.
62
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancesortreverse
63
+ Performance/SortReverse:
64
+ Enabled: true
65
+
66
+ # Identifies places where gsub(/a+/, 'a') and gsub!(/a+/, 'a') can be replaced by squeeze('a') and squeeze!('a').
67
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancesqueeze
68
+ Performance/Squeeze:
69
+ Enabled: true
70
+
34
71
  # Use `start_with?` instead of a regex match anchored to the beginning of a
35
72
  # string.
36
73
  Performance/StartWith:
37
74
  Enabled: true
38
75
 
76
+ # Identifies unnecessary use of a regex where String#include? would suffice.
77
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancestringinclude
78
+ Performance/StringInclude:
79
+ Enabled: true
80
+
39
81
  # Use `tr` instead of `gsub` when you are replacing the same number of
40
82
  # characters. Use `delete` instead of `gsub` when you are deleting
41
83
  # characters.
42
84
  Performance/StringReplacement:
43
85
  Enabled: true
44
86
 
87
+ # Identifies places where custom code finding the sum of elements in some
88
+ # Enumerable object can be replaced by Enumerable#sum method.
89
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancesum
90
+ Performance/Sum:
91
+ Enabled: true
92
+
45
93
  # Checks for `.times.map` calls.
46
94
  Performance/TimesMap:
47
95
  Enabled: true
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Enables Rails cops.
2
3
  Rails:
3
4
  Enabled: true
@@ -7,6 +8,18 @@ Rails/ActionFilter:
7
8
  Enabled: true
8
9
  EnforcedStyle: action
9
10
 
11
+ # Checks that Active Record callbacks are declared in the order in which they will be executed.
12
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsactiverecordcallbacksorder
13
+ Rails/ActiveRecordCallbacksOrder:
14
+ Enabled: true
15
+
16
+ # Enforces that there is only one call to after_commit
17
+ # (and its aliases - after_create_commit, after_update_commit, and after_destroy_commit)
18
+ # with the same callback name per model.
19
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsaftercommitoverride
20
+ Rails/AfterCommitOverride:
21
+ Enabled: true
22
+
10
23
  # Check that models subclass ApplicationRecord.
11
24
  Rails/ApplicationRecord:
12
25
  Enabled: false
@@ -43,6 +56,12 @@ Rails/FindBy:
43
56
  - 'app/**/*.rb'
44
57
  - 'lib/**/*.rb'
45
58
 
59
+ # Enforces that ActiveRecord#find is used instead of where.take!, find_by!, and find_by_id!
60
+ # to retrieve a single record by primary key when you expect it to be found.
61
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsfindbyid
62
+ Rails/FindById:
63
+ Enabled: true
64
+
46
65
  # Prefer `all.find_each` over `all.find`.
47
66
  Rails/FindEach:
48
67
  Enabled: true
@@ -57,6 +76,26 @@ Rails/HasAndBelongsToMany:
57
76
  Rails/HttpPositionalArguments:
58
77
  Enabled: true
59
78
 
79
+ # Checks that Active Support’s inquiry method is not used.
80
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsinquiry
81
+ Rails/Inquiry:
82
+ Enabled: true
83
+
84
+ # Enforces that mailer names end with Mailer suffix.
85
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsmailername
86
+ Rails/MailerName:
87
+ Enabled: true
88
+
89
+ # Identifies places where defining routes with match can be replaced with a specific HTTP method.
90
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsmatchroute
91
+ Rails/MatchRoute:
92
+ Enabled: true
93
+
94
+ # Enforces the use of collection.exclude?(obj) over !collection.include?(obj).
95
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsnegateinclude
96
+ Rails/NegateInclude:
97
+ Enabled: true
98
+
60
99
  # Checks for calls to puts, print, etc.
61
100
  Rails/Output:
62
101
  Enabled: true
@@ -71,6 +110,16 @@ Rails/Output:
71
110
  Rails/OutputSafety:
72
111
  Enabled: false
73
112
 
113
+ # Enforces the use of pluck over map.
114
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluck
115
+ Rails/Pluck:
116
+ Enabled: true
117
+
118
+ # Identifies places where pluck is used in where query methods and can be replaced with select.
119
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluckinwhere
120
+ Rails/PluckInWhere:
121
+ Enabled: true
122
+
74
123
  # Checks for incorrect grammar when using methods like `3.day.ago`.
75
124
  Rails/PluralizationGrammar:
76
125
  Enabled: true
@@ -87,10 +136,30 @@ Rails/ReadWriteAttribute:
87
136
  Rails/RelativeDateConstant:
88
137
  Enabled: false
89
138
 
139
+ # Looks for inline rendering within controller actions.
140
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsrenderinline
141
+ Rails/RenderInline:
142
+ Enabled: true
143
+
144
+ # Identifies places where render text: can be replaced with render plain:.
145
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsrenderplaintext
146
+ Rails/RenderPlainText:
147
+ Enabled: true
148
+
90
149
  # Checks the arguments of ActiveRecord scopes.
91
150
  Rails/ScopeArgs:
92
151
  Enabled: true
93
152
 
153
+ # Enforces that short forms of I18n methods are used: t instead of translate and l instead of localize.
154
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsshorti18n
155
+ Rails/ShortI18n:
156
+ Enabled: true
157
+
158
+ # Checks SQL heredocs to use .squish.
159
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railssquishedsqlheredocs
160
+ Rails/SquishedSQLHeredocs:
161
+ Enabled: true
162
+
94
163
  # This cop checks for the use of Time methods without zone.
95
164
  Rails/TimeZone:
96
165
  Enabled: false
@@ -98,3 +167,13 @@ Rails/TimeZone:
98
167
  # This cop checks for the use of old-style attribute validation macros.
99
168
  Rails/Validation:
100
169
  Enabled: true
170
+
171
+ # Enforces consistent style when using exists?.
172
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswhereexists
173
+ Rails/WhereExists:
174
+ Enabled: true
175
+
176
+ # Identifies places where manually constructed SQL in where can be replaced with where.not(...).
177
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswherenot
178
+ Rails/WhereNot:
179
+ Enabled: true
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Check that instances are not being stubbed globally.
2
3
  RSpec/AnyInstance:
3
4
  Enabled: false
@@ -36,6 +37,10 @@ RSpec/EmptyExampleGroup:
36
37
  - it_should_email!
37
38
  - it_should_not_email!
38
39
 
40
+ # Checks if there is an empty line after let blocks.
41
+ RSpec/EmptyLineAfterLetBlock:
42
+ Enabled: true
43
+
39
44
  # Checks if there is an empty line after shared example blocks.
40
45
  RSpec/EmptyLineAfterSharedExample:
41
46
  Enabled: true
@@ -138,6 +143,11 @@ RSpec/SingleLineHook:
138
143
  - 'spec/factories/*'
139
144
  - 'spec/requests/api/v3/*'
140
145
 
146
+ # Checks that message expectations do not have a configured response.
147
+ # https://docs.rubocop.org/rubocop-rspec/1.44/cops_rspec.html#rspecstubbedmock
148
+ RSpec/StubbedMock:
149
+ Enabled: false
150
+
141
151
  # Checks for stubbed test subjects.
142
152
  RSpec/SubjectStub:
143
153
  Enabled: false
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # This cop checks for the use of JSON class methods which have potential
2
3
  # security issues.
3
4
  Security/JSONLoad:
@@ -1,3 +1,9 @@
1
+ ---
2
+ # Checks for grouping of accessors in class and module bodies.
3
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleaccessorgrouping
4
+ Style/AccessorGrouping:
5
+ Enabled: true
6
+
1
7
  # Use alias_method instead of alias.
2
8
  Style/Alias:
3
9
  EnforcedStyle: prefer_alias_method
@@ -7,6 +13,12 @@ Style/Alias:
7
13
  # or completely (always).
8
14
  Style/AndOr:
9
15
  Enabled: true
16
+ EnforcedStyle: always
17
+
18
+ # Enforces the use of Array() instead of explicit Array check or [*var]
19
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylearraycoercion
20
+ Style/ArrayCoercion:
21
+ Enabled: true
10
22
 
11
23
  # Use `Array#join` instead of `Array#*`.
12
24
  Style/ArrayJoin:
@@ -24,6 +36,11 @@ Style/Attr:
24
36
  Style/BeginBlock:
25
37
  Enabled: true
26
38
 
39
+ # Checks for places where attr_reader and attr_writer for the same method can be combined into single attr_accessor.
40
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylebisectedattraccessor
41
+ Style/BisectedAttrAccessor:
42
+ Enabled: true
43
+
27
44
  # Do not use block comments.
28
45
  Style/BlockComments:
29
46
  Enabled: true
@@ -33,10 +50,15 @@ Style/BlockComments:
33
50
  Style/BlockDelimiters:
34
51
  Enabled: true
35
52
 
36
- # This cop checks for uses of the case equality operator(===).
53
+ # Checks for uses of the case equality operator(===).
37
54
  Style/CaseEquality:
38
55
  Enabled: false
39
56
 
57
+ # Identifies places where if-elsif constructions can be replaced with case-when.
58
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylecaselikeif
59
+ Style/CaseLikeIf:
60
+ Enabled: true
61
+
40
62
  # Checks for uses of character literals.
41
63
  Style/CharacterLiteral:
42
64
  Enabled: true
@@ -95,6 +117,12 @@ Style/EndBlock:
95
117
  Style/EvenOdd:
96
118
  Enabled: true
97
119
 
120
+ # Enforces the use of explicit block argument to avoid writing block literal that
121
+ # just passes its arguments to another block.
122
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleexplicitblockargument
123
+ Style/ExplicitBlockArgument:
124
+ Enabled: true
125
+
98
126
  # Enforces consistency when using exponential notation for numbers in the code
99
127
  Style/ExponentialNotation:
100
128
  Enabled: true
@@ -111,6 +139,13 @@ Style/FormatStringToken:
111
139
  Style/FrozenStringLiteralComment:
112
140
  Enabled: true
113
141
 
142
+ # Enforces the use of $stdout/$stderr/$stdin instead of STDOUT/STDERR/STDIN. STDOUT/STDERR/STDIN are constants,
143
+ # and while you can actually reassign (possibly to redirect some stream) constants in Ruby,
144
+ # you’ll get an interpreter warning if you do so.
145
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleglobalstdstream
146
+ Style/GlobalStdStream:
147
+ Enabled: true
148
+
114
149
  # Do not introduce global variables.
115
150
  Style/GlobalVars:
116
151
  Enabled: true
@@ -118,10 +153,20 @@ Style/GlobalVars:
118
153
  - 'lib/backup/**/*'
119
154
  - 'lib/tasks/**/*'
120
155
 
156
+ # Checks for presence or absence of braces around hash literal as a last array item depending on configuration.
157
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylehashaslastarrayitem
158
+ Style/HashAsLastArrayItem:
159
+ Enabled: true
160
+
121
161
  # Checks for uses of each_key and each_value Hash methods.
122
162
  Style/HashEachMethods:
123
163
  Enabled: true
124
164
 
165
+ # Checks for places where case-when represents a simple 1:1 mapping and can be replaced with a hash lookup.
166
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylehashlikecase
167
+ Style/HashLikeCase:
168
+ Enabled: false
169
+
125
170
  # Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
126
171
  # over 1.8 syntax `{ :a => 1, :b => 2 }`.
127
172
  Style/HashSyntax:
@@ -161,6 +206,11 @@ Style/InverseMethods:
161
206
  Style/LambdaCall:
162
207
  Enabled: true
163
208
 
209
+ # Checks for places where keyword arguments can be used instead of boolean arguments when defining methods.
210
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleoptionalbooleanparameter
211
+ Style/OptionalBooleanParameter:
212
+ Enabled: false
213
+
164
214
  # Use `strip` instead of `lstrip.rstrip`.
165
215
  Style/Strip:
166
216
  Enabled: true
@@ -248,10 +298,25 @@ Style/PreferredHashMethods:
248
298
  Style/RedundantCapitalW:
249
299
  Enabled: true
250
300
 
301
+ # Checks for redundant assignment before returning.
302
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantassignment
303
+ Style/RedundantAssignment:
304
+ Enabled: true
305
+
251
306
  # Checks for an obsolete RuntimeException argument in raise/fail.
252
307
  Style/RedundantException:
253
308
  Enabled: true
254
309
 
310
+ # Identifies places where fetch(key) { value } can be replaced by fetch(key, value).
311
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantfetchblock
312
+ Style/RedundantFetchBlock:
313
+ Enabled: true
314
+
315
+ # Checks for the presence of superfluous .rb extension in the filename provided to require and require_relative.
316
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantfileextensioninrequire
317
+ Style/RedundantFileExtensionInRequire:
318
+ Enabled: true
319
+
255
320
  # Checks for parentheses that seem not to serve any purpose.
256
321
  Style/RedundantParentheses:
257
322
  Enabled: true
@@ -260,6 +325,16 @@ Style/RedundantParentheses:
260
325
  Style/RedundantPercentQ:
261
326
  Enabled: false
262
327
 
328
+ # Checks for unnecessary single-element Regexp character classes.
329
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantregexpcharacterclass
330
+ Style/RedundantRegexpCharacterClass:
331
+ Enabled: true
332
+
333
+ # Checks for redundant escapes inside Regexp literals.
334
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantregexpescape
335
+ Style/RedundantRegexpEscape:
336
+ Enabled: true
337
+
263
338
  # Use `sort` instead of `sort_by { |x| x }`.
264
339
  Style/RedundantSortBy:
265
340
  Enabled: true
@@ -268,16 +343,31 @@ Style/RedundantSortBy:
268
343
  Style/Semicolon:
269
344
  Enabled: true
270
345
 
346
+ # Sometimes using dig method ends up with just a single argument. In such cases, dig should be replaced with [].
347
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylesingleargumentdig
348
+ Style/SingleArgumentDig:
349
+ Enabled: true
350
+
271
351
  # Checks for proper usage of fail and raise.
272
352
  Style/SignalException:
273
353
  EnforcedStyle: only_raise
274
354
  Enabled: true
275
355
 
356
+ # Checks that arrays are sliced with endless ranges instead of ary[start..-1] on Ruby 2.6+.
357
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleslicingwithrange
358
+ Style/SlicingWithRange:
359
+ Enabled: true
360
+
276
361
  # Check for the usage of parentheses around stabby lambda arguments.
277
362
  Style/StabbyLambdaParentheses:
278
363
  EnforcedStyle: require_parentheses
279
364
  Enabled: true
280
365
 
366
+ # Checks for places where string concatenation can be replaced with string interpolation.
367
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylestringconcatenation
368
+ Style/StringConcatenation:
369
+ Enabled: true
370
+
281
371
  # Checks if uses of quotes match the configured preference.
282
372
  Style/StringLiterals:
283
373
  Enabled: false