gitlab-styles 9.1.0 → 10.0.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +14 -2
  3. data/.rubocop.yml +2 -1
  4. data/.rubocop_todo.yml +12 -0
  5. data/.tests_mapping.yml +10 -0
  6. data/Gemfile +9 -4
  7. data/README.md +9 -8
  8. data/gitlab-styles.gemspec +7 -7
  9. data/lefthook.yml +11 -3
  10. data/lib/gitlab/styles/version.rb +1 -1
  11. data/lib/rubocop/cop/active_record_dependent.rb +0 -5
  12. data/lib/rubocop/cop/active_record_serialize.rb +0 -6
  13. data/lib/rubocop/cop/avoid_return_from_blocks.rb +4 -4
  14. data/lib/rubocop/cop/gem_fetcher.rb +18 -20
  15. data/lib/rubocop/cop/gitlab_security/deep_munge.rb +36 -0
  16. data/lib/rubocop/cop/gitlab_security/json_serialization.rb +133 -0
  17. data/lib/rubocop/cop/gitlab_security/public_send.rb +47 -0
  18. data/lib/rubocop/cop/gitlab_security/redirect_to_params_update.rb +38 -0
  19. data/lib/rubocop/cop/gitlab_security/send_file_params.rb +40 -0
  20. data/lib/rubocop/cop/gitlab_security/sql_injection.rb +41 -0
  21. data/lib/rubocop/cop/gitlab_security/system_command_injection.rb +38 -0
  22. data/lib/rubocop/cop/in_batches.rb +0 -2
  23. data/lib/rubocop/cop/line_break_after_guard_clauses.rb +3 -5
  24. data/lib/rubocop/cop/line_break_around_conditional_block.rb +5 -0
  25. data/lib/rubocop/cop/migration/update_large_table.rb +1 -0
  26. data/lib/rubocop/cop/polymorphic_associations.rb +0 -5
  27. data/lib/rubocop/cop/rails/include_url_helper.rb +0 -2
  28. data/lib/rubocop/cop/redirect_with_status.rb +44 -30
  29. data/lib/rubocop/cop/rspec/empty_line_after_shared_example.rb +1 -1
  30. data/rubocop-bundler.yml +10 -0
  31. data/rubocop-capybara.yml +8 -0
  32. data/rubocop-default.yml +1 -1
  33. data/rubocop-layout.yml +48 -4
  34. data/rubocop-lint.yml +131 -3
  35. data/rubocop-naming.yml +5 -0
  36. data/rubocop-performance.yml +32 -0
  37. data/rubocop-rails.yml +25 -0
  38. data/rubocop-rspec.yml +1 -5
  39. data/rubocop-security.yml +19 -1
  40. data/rubocop-style.yml +18 -3
  41. metadata +38 -29
  42. data/lib/gitlab/styles/rubocop/model_helpers.rb +0 -19
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module GitlabSecurity
6
+ # Check for use of system("/bin/ls #{params[:file]}")
7
+ #
8
+ # Passing user input to system() without sanitization and parameterization can result in command injection
9
+ #
10
+ # @example
11
+ #
12
+ # # bad
13
+ # system("/bin/ls #{filename}")
14
+ #
15
+ # # good (parameters)
16
+ # system("/bin/ls", filename)
17
+ # # even better
18
+ # exec("/bin/ls", shell_escape(filename))
19
+ #
20
+ class SystemCommandInjection < RuboCop::Cop::Base
21
+ MSG = 'Do not include variables in the command name for system(). ' \
22
+ 'Use parameters "system(cmd, params)" or exec() instead.'
23
+
24
+ # @!method system_var?(node)
25
+ def_node_matcher :system_var?, <<-PATTERN
26
+ (dstr (str ...) (begin ...) ...)
27
+ PATTERN
28
+
29
+ def on_send(node)
30
+ return unless node.command?(:system)
31
+ return unless node.arguments.any? { |e| system_var?(e) }
32
+
33
+ add_offense(node.loc.selector)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../gitlab/styles/rubocop/model_helpers'
4
-
5
3
  module Rubocop
6
4
  module Cop
7
5
  # Cop that prevents the use of `in_batches`
@@ -56,6 +56,8 @@ module Rubocop
56
56
  #
57
57
  # do_something_more
58
58
  class LineBreakAfterGuardClauses < RuboCop::Cop::Base
59
+ extend RuboCop::Cop::AutoCorrector
60
+
59
61
  MSG = 'Add a line break after guard clauses'
60
62
 
61
63
  # @!method guard_clause_node?(node)
@@ -68,11 +70,7 @@ module Rubocop
68
70
  return unless guard_clause?(node)
69
71
  return if next_line(node).blank? || clause_last_line?(next_line(node)) || guard_clause?(next_sibling(node))
70
72
 
71
- add_offense(node)
72
- end
73
-
74
- def autocorrect(node)
75
- lambda do |corrector|
73
+ add_offense(node) do |corrector|
76
74
  corrector.insert_after(node.loc.expression, "\n")
77
75
  end
78
76
  end
@@ -70,6 +70,7 @@ module Rubocop
70
70
  def previous_line_valid?(node)
71
71
  previous_line(node).empty? ||
72
72
  start_clause_line?(previous_line(node)) ||
73
+ method_def_end?(node.parent, previous_line(node)) ||
73
74
  block_start?(previous_line(node)) ||
74
75
  begin_line?(previous_line(node)) ||
75
76
  assignment_line?(previous_line(node)) ||
@@ -94,6 +95,10 @@ module Rubocop
94
95
  line =~ /^\s*(def|=end|#|module|class|if|unless|else|elsif|ensure|when)/
95
96
  end
96
97
 
98
+ def method_def_end?(node, line)
99
+ node.def_type? && /\)\s*(#.*)?$/.match?(line)
100
+ end
101
+
97
102
  def end_clause_line?(line)
98
103
  line =~ /^\s*(#|rescue|else|elsif|when)/
99
104
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative '../../../gitlab/styles/rubocop/migration_helpers'
3
4
 
4
5
  module Rubocop
@@ -1,17 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../gitlab/styles/rubocop/model_helpers'
4
-
5
3
  module Rubocop
6
4
  module Cop
7
5
  # Cop that prevents the use of polymorphic associations
8
6
  class PolymorphicAssociations < RuboCop::Cop::Base
9
- include Gitlab::Styles::Rubocop::ModelHelpers
10
-
11
7
  MSG = 'Do not use polymorphic associations, use separate tables instead'
12
8
 
13
9
  def on_send(node)
14
- return unless in_model?(node)
15
10
  return unless node.children[1] == :belongs_to
16
11
 
17
12
  node.children.last.each_node(:pair) do |pair|
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../../gitlab/styles/rubocop/model_helpers'
4
-
5
3
  module Rubocop
6
4
  module Cop
7
5
  module Rails
@@ -2,44 +2,58 @@
2
2
 
3
3
  module Rubocop
4
4
  module Cop
5
- # Prevents usage of 'redirect_to' in actions 'destroy' without specifying 'status'.
5
+ # Prevents usage of 'redirect_to' in actions 'destroy' and 'destroy_all'
6
+ # without specifying 'status'.
7
+ #
8
+ # @example
9
+ # # bad
10
+ #
11
+ # def destroy
12
+ # redirect_to root_path
13
+ # end
14
+ #
15
+ # def destroy_all
16
+ # redirect_to root_path, alert: 'Oh no!'
17
+ # end
18
+ #
19
+ # # good
20
+ #
21
+ # def destroy
22
+ # redirect_to root_path, status: 302
23
+ # end
24
+ #
25
+ # def destroy_all
26
+ # redirect_to root_path, alert: 'Oh no!', status: 302
27
+ # end
28
+ #
29
+ # def show
30
+ # redirect_to root_path
31
+ # end
32
+ #
6
33
  # See https://gitlab.com/gitlab-org/gitlab-ce/issues/31840
7
34
  class RedirectWithStatus < RuboCop::Cop::Base
8
- MSG = 'Do not use "redirect_to" without "status" in "destroy" action'
35
+ MSG = 'Do not use "redirect_to" without "status" in "%<name>s" action.'
9
36
 
10
- def on_def(node)
11
- return unless in_controller?(node)
12
- return unless destroy?(node) || destroy_all?(node)
37
+ RESTRICT_ON_SEND = %i[redirect_to].freeze
13
38
 
14
- node.each_descendant(:send) do |def_node|
15
- next unless redirect_to?(def_node)
39
+ ACTIONS = %i[destroy destroy_all].to_set.freeze
16
40
 
17
- methods = []
41
+ # @!method redirect_to_with_status?(node)
42
+ def_node_matcher :redirect_to_with_status?, <<~PATTERN
43
+ (send nil? :redirect_to ...
44
+ (hash <(pair (sym :status) _) ...>)
45
+ )
46
+ PATTERN
18
47
 
19
- def_node.children.last.each_node(:pair) do |pair|
20
- methods << pair.children.first.children.first
21
- end
48
+ def on_send(node)
49
+ return if redirect_to_with_status?(node)
22
50
 
23
- add_offense(def_node.loc.selector) unless methods.include?(:status)
24
- end
25
- end
26
-
27
- private
28
-
29
- def in_controller?(node)
30
- node.location.expression.source_buffer.name.end_with?('_controller.rb')
31
- end
51
+ node.each_ancestor(:def) do |def_node|
52
+ next unless ACTIONS.include?(def_node.method_name)
32
53
 
33
- def destroy?(node)
34
- node.children.first == :destroy
35
- end
36
-
37
- def destroy_all?(node)
38
- node.children.first == :destroy_all
39
- end
40
-
41
- def redirect_to?(node)
42
- node.children[1] == :redirect_to
54
+ message = format(MSG, name: def_node.method_name)
55
+ add_offense(node.loc.selector, message: message)
56
+ end
43
57
  end
44
58
  end
45
59
  end
@@ -45,7 +45,7 @@ module Rubocop
45
45
 
46
46
  # @!method shared_examples(node)
47
47
  def_node_matcher :shared_examples,
48
- block_pattern('{#SharedGroups.all #Includes.all}')
48
+ block_pattern('{#SharedGroups.all #Includes.all}')
49
49
 
50
50
  def on_block(node)
51
51
  shared_examples(node) do
data/rubocop-bundler.yml CHANGED
@@ -1,4 +1,14 @@
1
1
  ---
2
+ require:
3
+ - ./lib/rubocop/cop/gem_fetcher
4
+
2
5
  # Gems in consecutive lines should be alphabetically sorted
3
6
  Bundler/OrderedGems:
4
7
  Enabled: false
8
+
9
+ Cop/GemFetcher:
10
+ Enabled: true
11
+ Include:
12
+ - '**/*.gemfile'
13
+ - '**/Gemfile'
14
+ - '**/gems.rb'
@@ -0,0 +1,8 @@
1
+ ---
2
+ require:
3
+ - ./lib/gitlab/styles/rubocop
4
+
5
+ # Checks if there is a more specific finder offered by Capybara.
6
+ # https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/131#note_1141024624
7
+ Capybara/SpecificFinders:
8
+ Enabled: false
data/rubocop-default.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  require:
3
- - rubocop-gitlab-security
4
3
  - rubocop-performance
5
4
  - rubocop-rspec
6
5
  - rubocop-rails
@@ -10,6 +9,7 @@ require:
10
9
  inherit_from:
11
10
  - rubocop-all.yml
12
11
  - rubocop-bundler.yml
12
+ - rubocop-capybara.yml
13
13
  - rubocop-fips.yml
14
14
  - rubocop-gemspec.yml
15
15
  - rubocop-graphql.yml
data/rubocop-layout.yml CHANGED
@@ -3,9 +3,15 @@
3
3
  Layout/AccessModifierIndentation:
4
4
  Enabled: true
5
5
 
6
+ # Check if the arguments on a multi-line method definition are aligned.
7
+ Layout/ArgumentAlignment:
8
+ # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/42
9
+ EnforcedStyle: with_fixed_indentation
10
+
6
11
  # Align the elements of an array literal if they span more than one line.
7
12
  Layout/ArrayAlignment:
8
- Enabled: true
13
+ # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/42
14
+ EnforcedStyle: with_fixed_indentation
9
15
 
10
16
  # Checks the indentation of the first line of the right-hand-side of a
11
17
  # multi-line assignment.
@@ -48,9 +54,9 @@ Layout/DotPosition:
48
54
  Layout/ElseAlignment:
49
55
  Enabled: true
50
56
 
51
- # Add an empty line after magic comments to separate them from code.
57
+ # Checks for a newline after the final magic comment.
52
58
  Layout/EmptyLineAfterMagicComment:
53
- Enabled: false
59
+ Enabled: true
54
60
 
55
61
  # Use empty lines between defs.
56
62
  Layout/EmptyLineBetweenDefs:
@@ -102,6 +108,23 @@ Layout/EndOfLine:
102
108
  Layout/ExtraSpacing:
103
109
  Enabled: true
104
110
 
111
+ # Checks the indentation of the first argument in a method call.
112
+ Layout/FirstArgumentIndentation:
113
+ # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/42
114
+ EnforcedStyle: consistent
115
+
116
+ # Checks the indentation of the first element in an array literal where the
117
+ # opening bracket and the first element are on separate lines.
118
+ Layout/FirstArrayElementIndentation:
119
+ # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/42
120
+ EnforcedStyle: consistent
121
+
122
+ # Checks the indentation of the first key in a hash literal where the opening
123
+ # brace and the first key are on separate lines.
124
+ Layout/FirstHashElementIndentation:
125
+ # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/42
126
+ EnforcedStyle: consistent
127
+
105
128
  # Checks for a line break before the first parameter in a multi-line method
106
129
  # parameter definition.
107
130
  Layout/FirstMethodParameterLineBreak:
@@ -137,6 +160,17 @@ Layout/LineLength:
137
160
  Max: 120
138
161
  AllowedPatterns: ['\s#\srubocop']
139
162
 
163
+ # Checks that strings broken over multiple lines (by a backslash) contain
164
+ # trailing spaces instead of leading spaces (default) or leading spaces instead
165
+ # of trailing spaces.
166
+ Layout/LineContinuationLeadingSpace:
167
+ Enabled: true
168
+
169
+ # Checks that the backslash of a line continuation is separated from preceding
170
+ # text by exactly one space (default) or zero spaces.
171
+ Layout/LineContinuationSpacing:
172
+ Enabled: true
173
+
140
174
  # Checks that the closing brace in an array literal is either on the same line
141
175
  # as the last array element, or a new line.
142
176
  Layout/MultilineArrayBraceLayout:
@@ -147,6 +181,11 @@ Layout/MultilineArrayBraceLayout:
147
181
  Layout/MultilineBlockLayout:
148
182
  Enabled: true
149
183
 
184
+ # Checks the indentation of the next line after a line that ends with a string
185
+ # literal and a backslash.
186
+ Layout/LineEndStringConcatenationIndentation:
187
+ Enabled: true
188
+
150
189
  # Checks that the closing brace in a hash literal is either on the same line as
151
190
  # the last hash element, or a new line.
152
191
  Layout/MultilineHashBraceLayout:
@@ -177,7 +216,8 @@ Layout/MultilineOperationIndentation:
177
216
  # Here we check if the parameters on a multi-line method call or
178
217
  # definition are aligned.
179
218
  Layout/ParameterAlignment:
180
- Enabled: false
219
+ # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/42
220
+ EnforcedStyle: with_fixed_indentation
181
221
 
182
222
  # Use spaces after colons.
183
223
  Layout/SpaceAfterColon:
@@ -223,6 +263,10 @@ Layout/SpaceAroundOperators:
223
263
  Layout/SpaceBeforeBlockBraces:
224
264
  Enabled: true
225
265
 
266
+ # Checks for space between the name of a receiver and a left brackets.
267
+ Layout/SpaceBeforeBrackets:
268
+ Enabled: true
269
+
226
270
  # No spaces before commas.
227
271
  Layout/SpaceBeforeComma:
228
272
  Enabled: true
data/rubocop-lint.yml CHANGED
@@ -1,4 +1,8 @@
1
1
  ---
2
+ # Checks for mistyped shorthand assignments.
3
+ Lint/AmbiguousAssignment:
4
+ Enabled: true
5
+
2
6
  # Checks for ambiguous block association with method when param passed without
3
7
  # parentheses.
4
8
  Lint/AmbiguousBlockAssociation:
@@ -9,10 +13,19 @@ Lint/AmbiguousBlockAssociation:
9
13
  Lint/AmbiguousOperator:
10
14
  Enabled: true
11
15
 
16
+ # Looks for expressions containing multiple binary operators where precedence
17
+ # is ambiguous due to lack of parentheses.
18
+ Lint/AmbiguousOperatorPrecedence:
19
+ Enabled: true
20
+
21
+ # Checks for ambiguous ranges.
22
+ Lint/AmbiguousRange:
23
+ Enabled: true
24
+
12
25
  # This cop checks for ambiguous regexp literals in the first argument of
13
26
  # a method invocation without parentheses.
14
27
  Lint/AmbiguousRegexpLiteral:
15
- Enabled: false
28
+ Enabled: true
16
29
 
17
30
  # This cop checks for assignments in the conditions of
18
31
  # if/while/until.
@@ -31,6 +44,10 @@ Lint/CircularArgumentReference:
31
44
  Lint/ConstantDefinitionInBlock: # (new in 0.91)
32
45
  Enabled: true
33
46
 
47
+ # Checks for overwriting an exception with an exception result by use rescue =>.
48
+ Lint/ConstantOverwrittenInRescue:
49
+ Enabled: true
50
+
34
51
  # Check for debugger calls.
35
52
  Lint/Debugger:
36
53
  Enabled: true
@@ -39,17 +56,36 @@ Lint/Debugger:
39
56
  Lint/DeprecatedClassMethods:
40
57
  Enabled: true
41
58
 
59
+ # Checks for deprecated constants.
60
+ Lint/DeprecatedConstants:
61
+ Enabled: true
62
+
42
63
  # Algorithmic constants for OpenSSL::Cipher and OpenSSL::Digest deprecated since OpenSSL version 2.2.0.
43
64
  # Prefer passing a string instead.
44
65
  # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintdeprecatedopensslconstant
45
66
  Lint/DeprecatedOpenSSLConstant:
46
67
  Enabled: true
47
68
 
69
+ # Checks that there are no repeated bodies within if/unless, case-when, case-in
70
+ # and rescue constructs.
71
+ Lint/DuplicateBranch:
72
+ Enabled: true
73
+ IgnoreLiteralBranches: true
74
+ IgnoreConstantBranches: true
75
+
48
76
  # Checks that there are no repeated conditions used in if 'elsif'.
49
77
  # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintduplicateelsifcondition
50
78
  Lint/DuplicateElsifCondition:
51
79
  Enabled: true
52
80
 
81
+ # Checks for duplicated magic comments.
82
+ Lint/DuplicateMagicComment:
83
+ Enabled: true
84
+
85
+ # Checks for duplicate elements in Regexp character classes.
86
+ Lint/DuplicateRegexpCharacterClassElement:
87
+ Enabled: true
88
+
53
89
  Lint/DuplicateRequire: # (new in 0.90)
54
90
  Enabled: true
55
91
 
@@ -66,6 +102,17 @@ Lint/EachWithObjectArgument:
66
102
  Lint/ElseLayout:
67
103
  Enabled: true
68
104
 
105
+ # Checks for blocks without a body. Such empty blocks are typically an
106
+ # oversight or we should provide a comment be clearer what we’re aiming for.
107
+ Lint/EmptyBlock:
108
+ Enabled: true
109
+
110
+ # Checks for classes and metaclasses without a body. Such empty classes and
111
+ # metaclasses are typically an oversight or we should provide a comment to be
112
+ # clearer what we’re aiming for.
113
+ Lint/EmptyClass:
114
+ Enabled: true
115
+
69
116
  # Checks for the presence of if, elsif and unless branches without a body.
70
117
  # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintemptyconditionalbody
71
118
  Lint/EmptyConditionalBody:
@@ -78,6 +125,10 @@ Lint/EmptyEnsure:
78
125
  Lint/EmptyFile: # (new in 0.90)
79
126
  Enabled: true
80
127
 
128
+ # Checks for the presence of in pattern branches without a body.
129
+ Lint/EmptyInPattern:
130
+ Enabled: true
131
+
81
132
  # Checks for the presence of `when` branches without a body.
82
133
  Lint/EmptyWhen:
83
134
  Enabled: true
@@ -111,11 +162,21 @@ Lint/IdentityComparison: # (new in 0.91)
111
162
  Lint/ImplicitStringConcatenation:
112
163
  Enabled: true
113
164
 
165
+ # This cop checks for IO.select that is incompatible with Fiber Scheduler since
166
+ # Ruby 3.0.
167
+ Lint/IncompatibleIoSelectWithFiberScheduler:
168
+ Enabled: true
169
+
114
170
  # Checks for attempts to use `private` or `protected` to set the visibility
115
171
  # of a class method, which does not work.
116
172
  Lint/IneffectiveAccessModifier:
117
173
  Enabled: false
118
174
 
175
+ # Checks uses of lambda without a literal block. It emulates the following
176
+ # warning in Ruby 3.0:
177
+ Lint/LambdaWithoutLiteralBlock:
178
+ Enabled: true
179
+
119
180
  # Checks of literals used in conditions.
120
181
  Lint/LiteralAsCondition:
121
182
  Enabled: true
@@ -147,11 +208,30 @@ Lint/NestedMethodDefinition:
147
208
  Lint/NextWithoutAccumulator:
148
209
  Enabled: true
149
210
 
211
+ # Checks for non-atomic file operation. And then replace it with a nearly
212
+ # equivalent and atomic method.
213
+ Lint/NonAtomicFileOperation:
214
+ Enabled: true
215
+
216
+ # Checks for the presence of a return inside a begin..end block in assignment
217
+ # contexts.
218
+ Lint/NoReturnInBeginEndBlocks:
219
+ Enabled: true
220
+
221
+ # Checks for uses of numbered parameter assignment.
222
+ # Reason: Ruby >= 3.0 causes an error so no need to enable it.
223
+ Lint/NumberedParameterAssignment:
224
+ Enabled: false
225
+
150
226
  # Looks for references of Regexp captures that are out of range and thus always returns nil.
151
227
  # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintoutofrangeregexpref
152
228
  Lint/OutOfRangeRegexpRef:
153
229
  Enabled: true
154
230
 
231
+ # Checks for unintended or-assignment to a constant.
232
+ Lint/OrAssignmentToConstant:
233
+ Enabled: true
234
+
155
235
  # Checks for method calls with a space before the opening parenthesis.
156
236
  Lint/ParenthesesAsGroupedExpression:
157
237
  Enabled: true
@@ -165,6 +245,11 @@ Lint/RaiseException:
165
245
  Lint/RandOne:
166
246
  Enabled: true
167
247
 
248
+ # This cop checks for redundant sort method to Dir.glob and Dir[]. Sort globbed
249
+ # results by default in Ruby 3.0.
250
+ Lint/RedundantDirGlobSort:
251
+ Enabled: true
252
+
168
253
  # This cop checks for unneeded usages of splat expansion
169
254
  Lint/RedundantSplatExpansion:
170
255
  Enabled: false
@@ -173,10 +258,23 @@ Lint/RedundantSplatExpansion:
173
258
  Lint/RedundantStringCoercion:
174
259
  Enabled: true
175
260
 
261
+ # Checks if include or prepend is called in refine block.
262
+ Lint/RefinementImportMethods:
263
+ Enabled: true
264
+
176
265
  # Use parentheses in the method call to avoid confusion about precedence.
177
266
  Lint/RequireParentheses:
178
267
  Enabled: true
179
268
 
269
+ # Checks that a range literal is enclosed in parentheses when the end of the
270
+ # range is at a line break.
271
+ Lint/RequireRangeParentheses:
272
+ Enabled: true
273
+
274
+ # Checks for uses a file requiring itself with require_relative.
275
+ Lint/RequireRelativeSelfPath:
276
+ Enabled: true
277
+
180
278
  # Avoid rescuing the Exception class.
181
279
  Lint/RescueException:
182
280
  Enabled: true
@@ -207,6 +305,17 @@ Lint/StructNewOverride:
207
305
  Lint/SuppressedException:
208
306
  Enabled: false
209
307
 
308
+ # Checks for uses of literal strings converted to a symbol where a literal
309
+ # symbol could be used instead.
310
+ Lint/SymbolConversion:
311
+ Enabled: true
312
+ EnforcedStyle: strict
313
+
314
+ # Ensures that to_enum/enum_for, called for the current method, has correct
315
+ # arguments.
316
+ Lint/ToEnumArguments:
317
+ Enabled: true
318
+
210
319
  # Checks for top level return with arguments.
211
320
  # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#linttoplevelreturnwithargument
212
321
  Lint/TopLevelReturnWithArgument:
@@ -215,10 +324,25 @@ Lint/TopLevelReturnWithArgument:
215
324
  Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
216
325
  Enabled: true
217
326
 
327
+ # Checks for "triple quotes" (strings delimited by any odd number of quotes
328
+ # greater than 1).
329
+ Lint/TripleQuotes:
330
+ Enabled: true
331
+
218
332
  # Do not use prefix `_` for a variable that is used.
219
333
  Lint/UnderscorePrefixedVariableName:
220
334
  Enabled: true
221
335
 
336
+ # Checks for a block that is known to need more positional block arguments than
337
+ # are given.
338
+ Lint/UnexpectedBlockArity:
339
+ Enabled: true
340
+
341
+ # Looks for reduce or inject blocks where the value returned (implicitly or
342
+ # explicitly) does not include the accumulator.
343
+ Lint/UnmodifiedReduceAccumulator:
344
+ Enabled: true
345
+
222
346
  # This cop checks for using Fixnum or Bignum constant
223
347
  Lint/UnifiedInteger:
224
348
  Enabled: true
@@ -234,11 +358,11 @@ Lint/UnreachableLoop:
234
358
 
235
359
  # This cop checks for unused block arguments.
236
360
  Lint/UnusedBlockArgument:
237
- Enabled: false
361
+ Enabled: true
238
362
 
239
363
  # This cop checks for unused method arguments.
240
364
  Lint/UnusedMethodArgument:
241
- Enabled: false
365
+ Enabled: true
242
366
 
243
367
  # Checks for useless access modifiers.
244
368
  Lint/UselessAccessModifier:
@@ -263,6 +387,10 @@ Lint/UselessSetterCall:
263
387
  Lint/UselessTimes: # (new in 0.91)
264
388
  Enabled: true
265
389
 
390
+ # Looks for ruby2_keywords calls for methods that do not need it.
391
+ Lint/UselessRuby2Keywords:
392
+ Enabled: true
393
+
266
394
  # Possible use of operator/literal/variable in void context.
267
395
  Lint/Void:
268
396
  Enabled: true
data/rubocop-naming.yml CHANGED
@@ -27,6 +27,11 @@ Naming/FileName:
27
27
  Naming/MemoizedInstanceVariableName:
28
28
  Enabled: false
29
29
 
30
+ # Recommends the use of inclusive language instead of problematic terms.
31
+ Naming/InclusiveLanguage:
32
+ Enabled: true
33
+ CheckStrings: true
34
+
30
35
  # Use the configured style when naming methods.
31
36
  Naming/MethodName:
32
37
  Enabled: true