gitlab-styles 3.2.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +18 -0
  3. data/.gitignore +3 -1
  4. data/.gitlab-ci.yml +25 -4
  5. data/.gitlab/merge_request_templates/Release.md +35 -0
  6. data/.rubocop.yml +3 -1
  7. data/Gemfile +5 -2
  8. data/README.md +5 -0
  9. data/Rakefile +2 -0
  10. data/gitlab-styles.gemspec +8 -5
  11. data/lib/gitlab/styles.rb +2 -0
  12. data/lib/gitlab/styles/rubocop.rb +7 -0
  13. data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +4 -2
  14. data/lib/gitlab/styles/rubocop/cop/active_record_serialize.rb +3 -1
  15. data/lib/gitlab/styles/rubocop/cop/code_reuse/active_record.rb +131 -0
  16. data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +9 -4
  17. data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +4 -2
  18. data/lib/gitlab/styles/rubocop/cop/in_batches.rb +3 -1
  19. data/lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb +4 -2
  20. data/lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb +132 -0
  21. data/lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb +64 -0
  22. data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +4 -2
  23. data/lib/gitlab/styles/rubocop/cop/redirect_with_status.rb +3 -1
  24. data/lib/gitlab/styles/rubocop/cop/rspec/base.rb +18 -0
  25. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb +65 -0
  26. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb +65 -0
  27. data/lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb +13 -6
  28. data/lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb +6 -3
  29. data/lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb +13 -14
  30. data/lib/gitlab/styles/rubocop/cop/without_reactive_cache.rb +3 -1
  31. data/lib/gitlab/styles/rubocop/migration_helpers.rb +2 -0
  32. data/lib/gitlab/styles/rubocop/model_helpers.rb +3 -1
  33. data/lib/gitlab/styles/rubocop/rspec/helpers.rb +17 -0
  34. data/lib/gitlab/styles/version.rb +3 -1
  35. data/rubocop-all.yml +2 -1
  36. data/rubocop-bundler.yml +1 -0
  37. data/rubocop-code_reuse.yml +24 -0
  38. data/rubocop-default.yml +2 -0
  39. data/rubocop-gemspec.yml +1 -0
  40. data/rubocop-layout.yml +38 -22
  41. data/rubocop-lint.yml +81 -19
  42. data/rubocop-metrics.yml +1 -4
  43. data/rubocop-migrations.yml +22 -0
  44. data/rubocop-naming.yml +9 -8
  45. data/rubocop-performance.yml +48 -0
  46. data/rubocop-rails.yml +79 -0
  47. data/rubocop-rspec.yml +14 -0
  48. data/rubocop-security.yml +1 -0
  49. data/rubocop-style.yml +119 -15
  50. metadata +27 -17
  51. data/.rubocop_todo.yml +0 -7
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # A calculated magnitude based on number of assignments,
2
3
  # branches, and conditions.
3
4
  Metrics/AbcSize:
@@ -23,10 +24,6 @@ Metrics/CyclomaticComplexity:
23
24
  Enabled: true
24
25
  Max: 13
25
26
 
26
- # Limit lines to 80 characters.
27
- Metrics/LineLength:
28
- Enabled: false
29
-
30
27
  # Avoid methods longer than 10 lines of code.
31
28
  Metrics/MethodLength:
32
29
  Enabled: false
@@ -0,0 +1,22 @@
1
+ ---
2
+ # Checks for methods that may lead to batch type issues on a table that's been
3
+ # explicitly denied because of its size.
4
+ #
5
+ # Even though these methods perform functions to avoid
6
+ # downtime, using it with tables with millions of rows still causes a
7
+ # significant delay in the deploy process and is best avoided.
8
+ #
9
+ # See https://gitlab.com/gitlab-com/infrastructure/issues/1602 for more
10
+ # information.
11
+ # The default can be changed as follows:
12
+ # Migration/UpdateLargeTable:
13
+ # DeniedTables:
14
+ # - :usage_data
15
+ # - :version_checks
16
+ # DeniedMethods:
17
+ # - :add_column_with_default
18
+ # - :change_column_type_concurrently
19
+ # - :rename_column_concurrently
20
+ # - :update_column_in_batches
21
+ Migration/UpdateLargeTable:
22
+ Enabled: false
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Check the naming of accessor methods for get_/set_.
2
3
  Naming/AccessorMethodName:
3
4
  Enabled: false
@@ -30,6 +31,13 @@ Naming/MemoizedInstanceVariableName:
30
31
  Naming/MethodName:
31
32
  Enabled: true
32
33
 
34
+ # Method parameter names for how descriptive they are.
35
+ Naming/MethodParameterName:
36
+ Enabled: true
37
+ MinNameLength: 2
38
+ AllowedNames:
39
+ - _
40
+
33
41
  # Use `spam?` instead of `is_spam?`
34
42
  # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
35
43
  # NamePrefix: is_, has_, have_
@@ -37,18 +45,11 @@ Naming/MethodName:
37
45
  # NameWhitelist: is_a?
38
46
  Naming/PredicateName:
39
47
  Enabled: true
40
- NamePrefixBlacklist: is_
48
+ ForbiddenPrefixes: is_
41
49
  Exclude:
42
50
  - 'spec/**/*'
43
51
  - 'features/**/*'
44
52
 
45
- # Method parameter names for how descriptive they are.
46
- Naming/UncommunicativeMethodParamName:
47
- Enabled: true
48
- MinNameLength: 2
49
- AllowedNames:
50
- - _
51
-
52
53
  # Use the configured style when naming variables.
53
54
  Naming/VariableName:
54
55
  EnforcedStyle: snake_case
@@ -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,14 @@ 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
+
44
+ # Checks if there is an empty line after shared example blocks.
45
+ RSpec/EmptyLineAfterSharedExample:
46
+ Enabled: true
47
+
39
48
  # Checks for long example.
40
49
  RSpec/ExampleLength:
41
50
  Enabled: false
@@ -134,6 +143,11 @@ RSpec/SingleLineHook:
134
143
  - 'spec/factories/*'
135
144
  - 'spec/requests/api/v3/*'
136
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
+
137
151
  # Checks for stubbed test subjects.
138
152
  RSpec/SubjectStub:
139
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
@@ -8,6 +14,11 @@ Style/Alias:
8
14
  Style/AndOr:
9
15
  Enabled: true
10
16
 
17
+ # Enforces the use of Array() instead of explicit Array check or [*var]
18
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylearraycoercion
19
+ Style/ArrayCoercion:
20
+ Enabled: true
21
+
11
22
  # Use `Array#join` instead of `Array#*`.
12
23
  Style/ArrayJoin:
13
24
  Enabled: true
@@ -24,6 +35,11 @@ Style/Attr:
24
35
  Style/BeginBlock:
25
36
  Enabled: true
26
37
 
38
+ # Checks for places where attr_reader and attr_writer for the same method can be combined into single attr_accessor.
39
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylebisectedattraccessor
40
+ Style/BisectedAttrAccessor:
41
+ Enabled: true
42
+
27
43
  # Do not use block comments.
28
44
  Style/BlockComments:
29
45
  Enabled: true
@@ -33,15 +49,15 @@ Style/BlockComments:
33
49
  Style/BlockDelimiters:
34
50
  Enabled: true
35
51
 
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(===).
52
+ # Checks for uses of the case equality operator(===).
42
53
  Style/CaseEquality:
43
54
  Enabled: false
44
55
 
56
+ # Identifies places where if-elsif constructions can be replaced with case-when.
57
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylecaselikeif
58
+ Style/CaseLikeIf:
59
+ Enabled: true
60
+
45
61
  # Checks for uses of character literals.
46
62
  Style/CharacterLiteral:
47
63
  Enabled: true
@@ -100,6 +116,16 @@ Style/EndBlock:
100
116
  Style/EvenOdd:
101
117
  Enabled: true
102
118
 
119
+ # Enforces the use of explicit block argument to avoid writing block literal that
120
+ # just passes its arguments to another block.
121
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleexplicitblockargument
122
+ Style/ExplicitBlockArgument:
123
+ Enabled: true
124
+
125
+ # Enforces consistency when using exponential notation for numbers in the code
126
+ Style/ExponentialNotation:
127
+ Enabled: true
128
+
103
129
  # Checks use of for or each in multiline loops.
104
130
  Style/For:
105
131
  Enabled: true
@@ -110,7 +136,14 @@ Style/FormatStringToken:
110
136
 
111
137
  # Checks if there is a magic comment to enforce string literals
112
138
  Style/FrozenStringLiteralComment:
113
- Enabled: false
139
+ Enabled: true
140
+
141
+ # Enforces the use of $stdout/$stderr/$stdin instead of STDOUT/STDERR/STDIN. STDOUT/STDERR/STDIN are constants,
142
+ # and while you can actually reassign (possibly to redirect some stream) constants in Ruby,
143
+ # you’ll get an interpreter warning if you do so.
144
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleglobalstdstream
145
+ Style/GlobalStdStream:
146
+ Enabled: true
114
147
 
115
148
  # Do not introduce global variables.
116
149
  Style/GlobalVars:
@@ -119,11 +152,37 @@ Style/GlobalVars:
119
152
  - 'lib/backup/**/*'
120
153
  - 'lib/tasks/**/*'
121
154
 
155
+ # Checks for presence or absence of braces around hash literal as a last array item depending on configuration.
156
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylehashaslastarrayitem
157
+ Style/HashAsLastArrayItem:
158
+ Enabled: true
159
+
160
+ # Checks for uses of each_key and each_value Hash methods.
161
+ Style/HashEachMethods:
162
+ Enabled: true
163
+
164
+ # Checks for places where case-when represents a simple 1:1 mapping and can be replaced with a hash lookup.
165
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylehashlikecase
166
+ Style/HashLikeCase:
167
+ Enabled: false
168
+
122
169
  # Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
123
170
  # over 1.8 syntax `{ :a => 1, :b => 2 }`.
124
171
  Style/HashSyntax:
125
172
  Enabled: true
126
173
 
174
+ # looks for uses of _.each_with_object({}) {...}, _.map {...}.to_h, and Hash[_.map {...}]
175
+ # that are actually just transforming the keys of a hash, and tries to use a simpler & faster
176
+ # call to transform_keys instead.
177
+ Style/HashTransformKeys:
178
+ Enabled: true
179
+
180
+ # looks for uses of _.each_with_object({}) {...}, _.map {...}.to_h, and Hash[_.map {...}]
181
+ # that are actually just transforming the values of a hash, and tries to use a simpler & faster
182
+ # call to transform_values instead.
183
+ Style/HashTransformValues:
184
+ Enabled: true
185
+
127
186
  # Checks that conditional statements do not have an identical line at the
128
187
  # end of each branch, which can validly be moved out of the conditional.
129
188
  Style/IdenticalConditionalBranches:
@@ -146,6 +205,11 @@ Style/InverseMethods:
146
205
  Style/LambdaCall:
147
206
  Enabled: true
148
207
 
208
+ # Checks for places where keyword arguments can be used instead of boolean arguments when defining methods.
209
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleoptionalbooleanparameter
210
+ Style/OptionalBooleanParameter:
211
+ Enabled: false
212
+
149
213
  # Use `strip` instead of `lstrip.rstrip`.
150
214
  Style/Strip:
151
215
  Enabled: true
@@ -229,14 +293,47 @@ Style/ParenthesesAroundCondition:
229
293
  Style/PreferredHashMethods:
230
294
  Enabled: false
231
295
 
296
+ # Checks for %W when interpolation is not needed.
297
+ Style/RedundantCapitalW:
298
+ Enabled: true
299
+
300
+ # Checks for redundant assignment before returning.
301
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantassignment
302
+ Style/RedundantAssignment:
303
+ Enabled: true
304
+
232
305
  # Checks for an obsolete RuntimeException argument in raise/fail.
233
306
  Style/RedundantException:
234
307
  Enabled: true
235
308
 
309
+ # Identifies places where fetch(key) { value } can be replaced by fetch(key, value).
310
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantfetchblock
311
+ Style/RedundantFetchBlock:
312
+ Enabled: true
313
+
314
+ # Checks for the presence of superfluous .rb extension in the filename provided to require and require_relative.
315
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantfileextensioninrequire
316
+ Style/RedundantFileExtensionInRequire:
317
+ Enabled: true
318
+
236
319
  # Checks for parentheses that seem not to serve any purpose.
237
320
  Style/RedundantParentheses:
238
321
  Enabled: true
239
322
 
323
+ # Checks for %q/%Q when single quotes or double quotes would do.
324
+ Style/RedundantPercentQ:
325
+ Enabled: false
326
+
327
+ # Checks for unnecessary single-element Regexp character classes.
328
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantregexpcharacterclass
329
+ Style/RedundantRegexpCharacterClass:
330
+ Enabled: true
331
+
332
+ # Checks for redundant escapes inside Regexp literals.
333
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantregexpescape
334
+ Style/RedundantRegexpEscape:
335
+ Enabled: true
336
+
240
337
  # Use `sort` instead of `sort_by { |x| x }`.
241
338
  Style/RedundantSortBy:
242
339
  Enabled: true
@@ -245,16 +342,31 @@ Style/RedundantSortBy:
245
342
  Style/Semicolon:
246
343
  Enabled: true
247
344
 
345
+ # Sometimes using dig method ends up with just a single argument. In such cases, dig should be replaced with [].
346
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylesingleargumentdig
347
+ Style/SingleArgumentDig:
348
+ Enabled: true
349
+
248
350
  # Checks for proper usage of fail and raise.
249
351
  Style/SignalException:
250
352
  EnforcedStyle: only_raise
251
353
  Enabled: true
252
354
 
355
+ # Checks that arrays are sliced with endless ranges instead of ary[start..-1] on Ruby 2.6+.
356
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleslicingwithrange
357
+ Style/SlicingWithRange:
358
+ Enabled: true
359
+
253
360
  # Check for the usage of parentheses around stabby lambda arguments.
254
361
  Style/StabbyLambdaParentheses:
255
362
  EnforcedStyle: require_parentheses
256
363
  Enabled: true
257
364
 
365
+ # Checks for places where string concatenation can be replaced with string interpolation.
366
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylestringconcatenation
367
+ Style/StringConcatenation:
368
+ Enabled: true
369
+
258
370
  # Checks if uses of quotes match the configured preference.
259
371
  Style/StringLiterals:
260
372
  Enabled: false
@@ -284,14 +396,6 @@ Style/TrailingCommaInArguments:
284
396
  Enabled: true
285
397
  EnforcedStyleForMultiline: no_comma
286
398
 
287
- # Checks for %W when interpolation is not needed.
288
- Style/UnneededCapitalW:
289
- Enabled: true
290
-
291
- # Checks for %q/%Q when single quotes or double quotes would do.
292
- Style/UnneededPercentQ:
293
- Enabled: false
294
-
295
399
  # Don't interpolate global, instance and class variables directly in strings.
296
400
  Style/VariableInterpolation:
297
401
  Enabled: true