rubocop 0.59.2 → 0.60.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +3 -2
  3. data/config/default.yml +2960 -552
  4. data/lib/rubocop.rb +1 -0
  5. data/lib/rubocop/ast/builder.rb +29 -29
  6. data/lib/rubocop/ast/node.rb +29 -25
  7. data/lib/rubocop/ast/node/args_node.rb +1 -1
  8. data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +1 -1
  9. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +26 -0
  10. data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +5 -1
  11. data/lib/rubocop/ast/node/pair_node.rb +8 -1
  12. data/lib/rubocop/ast/node/str_node.rb +1 -1
  13. data/lib/rubocop/cached_data.rb +2 -2
  14. data/lib/rubocop/config.rb +1 -1
  15. data/lib/rubocop/config_loader.rb +8 -0
  16. data/lib/rubocop/cop/autocorrect_logic.rb +7 -1
  17. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +1 -1
  18. data/lib/rubocop/cop/correctors/alignment_corrector.rb +2 -1
  19. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -1
  20. data/lib/rubocop/cop/generator.rb +10 -3
  21. data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
  22. data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +1 -1
  23. data/lib/rubocop/cop/layout/align_hash.rb +9 -1
  24. data/lib/rubocop/cop/layout/block_end_newline.rb +2 -4
  25. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +7 -7
  26. data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
  27. data/lib/rubocop/cop/layout/dot_position.rb +2 -2
  28. data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
  29. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +1 -2
  30. data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
  31. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +25 -25
  32. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
  33. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
  34. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -1
  35. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
  36. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +1 -1
  37. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
  38. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +1 -1
  39. data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
  40. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +1 -1
  41. data/lib/rubocop/cop/layout/indent_hash.rb +1 -1
  42. data/lib/rubocop/cop/layout/indent_heredoc.rb +2 -2
  43. data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
  44. data/lib/rubocop/cop/layout/indentation_width.rb +1 -1
  45. data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
  46. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
  47. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +1 -1
  48. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +84 -43
  49. data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
  50. data/lib/rubocop/cop/layout/space_around_keyword.rb +1 -1
  51. data/lib/rubocop/cop/layout/space_around_operators.rb +3 -2
  52. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +1 -1
  53. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +2 -2
  54. data/lib/rubocop/cop/lint/ambiguous_operator.rb +5 -5
  55. data/lib/rubocop/cop/lint/assignment_in_condition.rb +10 -20
  56. data/lib/rubocop/cop/lint/ensure_return.rb +3 -0
  57. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +3 -3
  58. data/lib/rubocop/cop/lint/literal_as_condition.rb +1 -1
  59. data/lib/rubocop/cop/lint/percent_string_array.rb +2 -2
  60. data/lib/rubocop/cop/lint/percent_symbol_array.rb +10 -7
  61. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +3 -4
  62. data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -2
  63. data/lib/rubocop/cop/lint/syntax.rb +3 -2
  64. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +3 -3
  65. data/lib/rubocop/cop/lint/useless_setter_call.rb +4 -7
  66. data/lib/rubocop/cop/metrics/abc_size.rb +1 -17
  67. data/lib/rubocop/cop/metrics/line_length.rb +14 -10
  68. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +45 -0
  69. data/lib/rubocop/cop/mixin/check_assignment.rb +12 -6
  70. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +1 -1
  71. data/lib/rubocop/cop/mixin/configurable_formatting.rb +0 -2
  72. data/lib/rubocop/cop/mixin/configurable_max.rb +4 -2
  73. data/lib/rubocop/cop/mixin/configurable_naming.rb +1 -1
  74. data/lib/rubocop/cop/mixin/configurable_numbering.rb +2 -2
  75. data/lib/rubocop/cop/mixin/hash_alignment.rb +32 -5
  76. data/lib/rubocop/cop/mixin/heredoc.rb +1 -1
  77. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +3 -4
  78. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -1
  79. data/lib/rubocop/cop/mixin/statement_modifier.rb +4 -0
  80. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  81. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +1 -1
  82. data/lib/rubocop/cop/naming/constant_name.rb +1 -1
  83. data/lib/rubocop/cop/naming/file_name.rb +1 -1
  84. data/lib/rubocop/cop/naming/method_name.rb +2 -0
  85. data/lib/rubocop/cop/naming/variable_number.rb +1 -1
  86. data/lib/rubocop/cop/offense.rb +1 -1
  87. data/lib/rubocop/cop/performance/regexp_match.rb +1 -1
  88. data/lib/rubocop/cop/performance/sample.rb +3 -2
  89. data/lib/rubocop/cop/performance/start_with.rb +1 -1
  90. data/lib/rubocop/cop/performance/string_replacement.rb +1 -1
  91. data/lib/rubocop/cop/rails/date.rb +8 -8
  92. data/lib/rubocop/cop/rails/dynamic_find_by.rb +1 -1
  93. data/lib/rubocop/cop/rails/exit.rb +8 -9
  94. data/lib/rubocop/cop/rails/output_safety.rb +3 -3
  95. data/lib/rubocop/cop/rails/read_write_attribute.rb +5 -4
  96. data/lib/rubocop/cop/rails/refute_methods.rb +13 -13
  97. data/lib/rubocop/cop/rails/reversible_migration.rb +2 -1
  98. data/lib/rubocop/cop/rails/skips_model_validations.rb +17 -0
  99. data/lib/rubocop/cop/registry.rb +11 -2
  100. data/lib/rubocop/cop/style/and_or.rb +3 -3
  101. data/lib/rubocop/cop/style/collection_methods.rb +26 -0
  102. data/lib/rubocop/cop/style/empty_literal.rb +1 -1
  103. data/lib/rubocop/cop/style/encoding.rb +1 -1
  104. data/lib/rubocop/cop/style/even_odd.rb +2 -2
  105. data/lib/rubocop/cop/style/for.rb +3 -3
  106. data/lib/rubocop/cop/style/global_vars.rb +1 -1
  107. data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
  108. data/lib/rubocop/cop/style/if_unless_modifier.rb +1 -13
  109. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  110. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  111. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +4 -7
  112. data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
  113. data/lib/rubocop/cop/style/module_function.rb +1 -1
  114. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  115. data/lib/rubocop/cop/style/mutable_constant.rb +15 -1
  116. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  117. data/lib/rubocop/cop/style/not.rb +2 -1
  118. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +6 -6
  119. data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
  120. data/lib/rubocop/cop/style/numeric_predicate.rb +1 -1
  121. data/lib/rubocop/cop/style/one_line_conditional.rb +2 -2
  122. data/lib/rubocop/cop/style/parentheses_around_condition.rb +1 -1
  123. data/lib/rubocop/cop/style/proc.rb +1 -1
  124. data/lib/rubocop/cop/style/redundant_freeze.rb +10 -0
  125. data/lib/rubocop/cop/style/redundant_parentheses.rb +6 -2
  126. data/lib/rubocop/cop/style/redundant_self.rb +1 -1
  127. data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
  128. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  129. data/lib/rubocop/cop/style/ternary_parentheses.rb +4 -3
  130. data/lib/rubocop/cop/style/unneeded_condition.rb +2 -2
  131. data/lib/rubocop/cop/style/unneeded_percent_q.rb +2 -2
  132. data/lib/rubocop/cop/style/unpack_first.rb +1 -1
  133. data/lib/rubocop/cop/team.rb +3 -2
  134. data/lib/rubocop/cop/util.rb +2 -22
  135. data/lib/rubocop/cop/variable_force/scope.rb +3 -3
  136. data/lib/rubocop/cop/variable_force/variable.rb +3 -4
  137. data/lib/rubocop/cop/variable_force/variable_table.rb +2 -2
  138. data/lib/rubocop/formatter/base_formatter.rb +3 -3
  139. data/lib/rubocop/formatter/disabled_config_formatter.rb +16 -1
  140. data/lib/rubocop/formatter/formatter_set.rb +14 -14
  141. data/lib/rubocop/formatter/html_formatter.rb +4 -4
  142. data/lib/rubocop/formatter/json_formatter.rb +13 -13
  143. data/lib/rubocop/formatter/simple_text_formatter.rb +4 -4
  144. data/lib/rubocop/magic_comment.rb +4 -4
  145. data/lib/rubocop/node_pattern.rb +17 -17
  146. data/lib/rubocop/options.rb +93 -82
  147. data/lib/rubocop/result_cache.rb +9 -1
  148. data/lib/rubocop/rspec/expect_offense.rb +2 -2
  149. data/lib/rubocop/rspec/shared_contexts.rb +11 -11
  150. data/lib/rubocop/rspec/shared_examples.rb +4 -4
  151. data/lib/rubocop/string_interpreter.rb +1 -1
  152. data/lib/rubocop/version.rb +1 -1
  153. metadata +6 -13
  154. data/config/disabled.yml +0 -161
  155. data/config/enabled.yml +0 -2092
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 28eeb813f59ba82f401cfac05daa5a118a1014af
4
- data.tar.gz: 63b3201d008b9f790f93cc5a724c1a596bd75dd4
2
+ SHA256:
3
+ metadata.gz: ee5ff0ea8f14348a06f12d9821d3d53fe6bae43f494d9963c474acf1f09d8926
4
+ data.tar.gz: 30955fdcca4ed2acb2b4ebfece201cab06dcaa61b354f7d7d1b54e796a41e6aa
5
5
  SHA512:
6
- metadata.gz: c79b61631cdc0e7fd9f0a8b17b0d04956827286239a7f65948e5a9cfec8f4a286dc1e6f062d9d0f5f2bdeaab06ff6dd2d2e10ddcd962dc6446f46ddd64bdbb5a
7
- data.tar.gz: b348fe1df3db7a302023b32fd4fafa3ab2a4b09edd99efdfc55f3d8dba27ac18dd118eeeb008702467cd188c96104309b99800a428224de17758a6cd4d95c3eb
6
+ metadata.gz: c418da4113b32159d9782d6495f00df32aef733b350d11dc7764b724b8809a1ecd11a4cb866503921cefc1532ffea91fe029922bae2906044044cf09c09e92b1
7
+ data.tar.gz: ecb81bf9cf67febbeddb027cab43b1ba0d77fcdcbed7db1ee836ad51267d29f1ab753ca2d49e2b213e58ec0514c764a3b0556fe7a7c25a53f0ec873b8a397e8e
data/README.md CHANGED
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
53
53
  might want to use a conservative version locking in your `Gemfile`:
54
54
 
55
55
  ```rb
56
- gem 'rubocop', '~> 0.59.2', require: false
56
+ gem 'rubocop', '~> 0.60.0', require: false
57
57
  ```
58
58
 
59
59
  ## Quickstart
@@ -86,11 +86,12 @@ Here's a list of RuboCop's core developers:
86
86
 
87
87
  * [Bozhidar Batsov](https://github.com/bbatsov) (author & head maintainer)
88
88
  * [Jonas Arvidsson](https://github.com/jonas054)
89
- * [Yuji Nakayama](https://github.com/yujinakayama)
89
+ * [Yuji Nakayama](https://github.com/yujinakayama) (retired)
90
90
  * [Evgeni Dzhelyov](https://github.com/edzhelyov) (retired)
91
91
  * [Ted Johansson](https://github.com/drenmi)
92
92
  * [Masataka Kuwabara](https://github.com/pocke)
93
93
  * [Koichi Ito](https://github.com/koic)
94
+ * [Maxim Krizhanovski](https://github.com/darhazer)
94
95
 
95
96
  ## Logo
96
97
 
@@ -1,11 +1,5 @@
1
- # This is the default configuration file. Enabling and disabling is configured
2
- # in separate files. This file adds all other parameters apart from Enabled.
3
-
4
- inherit_from:
5
- - enabled.yml
6
- - disabled.yml
7
-
8
1
  # Common configuration.
2
+
9
3
  AllCops:
10
4
  RubyInterpreters:
11
5
  - ruby
@@ -88,15 +82,15 @@ AllCops:
88
82
  # default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
89
83
  # the `--only-guide-cops` option.
90
84
  StyleGuideCopsOnly: false
91
- # All cops except the ones in disabled.yml are enabled by default. Change
92
- # this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
85
+ # All cops except the ones configured `Enabled: false` in this file are enabled by default.
86
+ # Change this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
93
87
  # When `DisabledByDefault` is `true`, all cops in the default configuration
94
88
  # are disabled, and only cops in user configuration are enabled. This makes
95
89
  # cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
96
90
  # cops in user configuration will be enabled even if they don't set the
97
91
  # Enabled parameter.
98
- # When `EnabledByDefault` is `true`, all cops, even those in disabled.yml,
99
- # are enabled by default. Cops can still be disabled in user configuration.
92
+ # When `EnabledByDefault` is `true`, all cops, even those configured `Enabled: false`
93
+ # in this file are enabled by default. Cops can still be disabled in user configuration.
100
94
  # Note that it is invalid to set both EnabledByDefault and DisabledByDefault
101
95
  # to true in the same configuration.
102
96
  EnabledByDefault: false
@@ -140,10 +134,83 @@ AllCops:
140
134
  # as the default.
141
135
  TargetRailsVersion: ~
142
136
 
137
+ #################### Bundler ###############################
138
+
139
+ Bundler/DuplicatedGem:
140
+ Description: 'Checks for duplicate gem entries in Gemfile.'
141
+ Enabled: true
142
+ VersionAdded: 0.46
143
+ Include:
144
+ - '**/*.gemfile'
145
+ - '**/Gemfile'
146
+ - '**/gems.rb'
147
+
148
+ Bundler/GemComment:
149
+ Description: 'Add a comment describing each gem.'
150
+ Enabled: false
151
+ VersionAdded: 0.59
152
+ Include:
153
+ - '**/*.gemfile'
154
+ - '**/Gemfile'
155
+ - '**/gems.rb'
156
+ Whitelist: []
157
+
158
+ Bundler/InsecureProtocolSource:
159
+ Description: >-
160
+ The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
161
+ because HTTP requests are insecure. Please change your source to
162
+ 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
163
+ Enabled: true
164
+ VersionAdded: 0.50
165
+ Include:
166
+ - '**/*.gemfile'
167
+ - '**/Gemfile'
168
+ - '**/gems.rb'
169
+
170
+ Bundler/OrderedGems:
171
+ Description: >-
172
+ Gems within groups in the Gemfile should be alphabetically sorted.
173
+ Enabled: true
174
+ VersionAdded: 0.46
175
+ VersionChanged: 0.47
176
+ TreatCommentsAsGroupSeparators: true
177
+ Include:
178
+ - '**/*.gemfile'
179
+ - '**/Gemfile'
180
+ - '**/gems.rb'
181
+
182
+ #################### Gemspec ###############################
183
+
184
+ Gemspec/DuplicatedAssignment:
185
+ Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
186
+ Enabled: true
187
+ VersionAdded: 0.52
188
+ Include:
189
+ - '**/*.gemspec'
190
+
191
+ Gemspec/OrderedDependencies:
192
+ Description: >-
193
+ Dependencies in the gemspec should be alphabetically sorted.
194
+ Enabled: true
195
+ VersionAdded: 0.51
196
+ TreatCommentsAsGroupSeparators: true
197
+ Include:
198
+ - '**/*.gemspec'
199
+
200
+ Gemspec/RequiredRubyVersion:
201
+ Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
202
+ Enabled: true
203
+ VersionAdded: 0.52
204
+ Include:
205
+ - '**/*.gemspec'
206
+
143
207
  #################### Layout ###########################
144
208
 
145
- # Indent private/protected/public as deep as method definitions
146
209
  Layout/AccessModifierIndentation:
210
+ Description: Check indentation of private/protected visibility modifiers.
211
+ StyleGuide: '#indent-public-private-protected'
212
+ Enabled: true
213
+ VersionAdded: 0.49
147
214
  EnforcedStyle: indent
148
215
  SupportedStyles:
149
216
  - outdent
@@ -152,8 +219,20 @@ Layout/AccessModifierIndentation:
152
219
  # But it can be overridden by setting this parameter
153
220
  IndentationWidth: ~
154
221
 
155
- # Align the elements of a hash literal if they span more than one line.
222
+ Layout/AlignArray:
223
+ Description: >-
224
+ Align the elements of an array literal if they span more than
225
+ one line.
226
+ StyleGuide: '#align-multiline-arrays'
227
+ Enabled: true
228
+ VersionAdded: 0.49
229
+
156
230
  Layout/AlignHash:
231
+ Description: >-
232
+ Align the elements of a hash literal if they span more than
233
+ one line.
234
+ Enabled: true
235
+ VersionAdded: 0.49
157
236
  # Alignment of entries using hash rocket as separator. Valid values are:
158
237
  #
159
238
  # key - left alignment of keys
@@ -225,6 +304,12 @@ Layout/AlignHash:
225
304
  - ignore_explicit
226
305
 
227
306
  Layout/AlignParameters:
307
+ Description: >-
308
+ Align the parameters of a method call if they span more
309
+ than one line.
310
+ StyleGuide: '#no-double-indent'
311
+ Enabled: true
312
+ VersionAdded: 0.49
228
313
  # Alignment of parameters in multi-line method calls.
229
314
  #
230
315
  # The `with_first_parameter` style aligns the following lines along the same
@@ -246,8 +331,10 @@ Layout/AlignParameters:
246
331
  # But it can be overridden by setting this parameter
247
332
  IndentationWidth: ~
248
333
 
249
- # checks whether the end keywords are aligned properly for `do` `end` blocks.
250
334
  Layout/BlockAlignment:
335
+ Description: 'Align block ends correctly.'
336
+ Enabled: true
337
+ VersionAdded: 0.53
251
338
  # The value `start_of_block` means that the `end` should be aligned with line
252
339
  # where the `do` keyword appears.
253
340
  # The value `start_of_line` means it should be aligned with the whole
@@ -259,8 +346,16 @@ Layout/BlockAlignment:
259
346
  - start_of_block
260
347
  - start_of_line
261
348
 
262
- # Indentation of `when`.
349
+ Layout/BlockEndNewline:
350
+ Description: 'Put end statement of multiline block on its own line.'
351
+ Enabled: true
352
+ VersionAdded: 0.49
353
+
263
354
  Layout/CaseIndentation:
355
+ Description: 'Indentation of when in a case/when/[else/]end.'
356
+ StyleGuide: '#indent-when-to-case'
357
+ Enabled: true
358
+ VersionAdded: 0.49
264
359
  EnforcedStyle: case
265
360
  SupportedStyles:
266
361
  - case
@@ -271,7 +366,52 @@ Layout/CaseIndentation:
271
366
  # This only matters if `IndentOneStep` is `true`
272
367
  IndentationWidth: ~
273
368
 
369
+ Layout/ClassStructure:
370
+ Description: 'Enforces a configured order of definitions within a class body.'
371
+ StyleGuide: 'https://github.com/rubocop-hq/ruby-style-guide#consistent-classes'
372
+ Enabled: false
373
+ VersionAdded: 0.52
374
+ Categories:
375
+ module_inclusion:
376
+ - include
377
+ - prepend
378
+ - extend
379
+ ExpectedOrder:
380
+ - module_inclusion
381
+ - constants
382
+ - public_class_methods
383
+ - initializer
384
+ - public_methods
385
+ - protected_methods
386
+ - private_methods
387
+
388
+ Layout/ClosingHeredocIndentation:
389
+ Description: 'Checks the indentation of here document closings.'
390
+ Enabled: true
391
+ VersionAdded: 0.57
392
+
393
+ Layout/ClosingParenthesisIndentation:
394
+ Description: 'Checks the indentation of hanging closing parentheses.'
395
+ Enabled: true
396
+ VersionAdded: 0.49
397
+
398
+ Layout/CommentIndentation:
399
+ Description: 'Indentation of comments.'
400
+ Enabled: true
401
+ VersionAdded: 0.49
402
+
403
+ Layout/ConditionPosition:
404
+ Description: >-
405
+ Checks for condition placed in a confusing position relative to
406
+ the keyword.
407
+ StyleGuide: '#same-line-condition'
408
+ Enabled: true
409
+ VersionAdded: 0.53
410
+
274
411
  Layout/DefEndAlignment:
412
+ Description: 'Align ends corresponding to defs correctly.'
413
+ Enabled: true
414
+ VersionAdded: 0.53
275
415
  # The value `def` means that `end` should be aligned with the def keyword.
276
416
  # The value `start_of_line` means that `end` should be aligned with method
277
417
  # calls like `private`, `public`, etc, if present in front of the `def`
@@ -283,32 +423,90 @@ Layout/DefEndAlignment:
283
423
  AutoCorrect: false
284
424
  Severity: warning
285
425
 
286
- # Multi-line method chaining should be done with leading dots.
287
426
  Layout/DotPosition:
427
+ Description: 'Checks the position of the dot in multi-line method calls.'
428
+ StyleGuide: '#consistent-multi-line-chains'
429
+ Enabled: true
430
+ VersionAdded: 0.49
288
431
  EnforcedStyle: leading
289
432
  SupportedStyles:
290
433
  - leading
291
434
  - trailing
292
435
 
436
+ Layout/ElseAlignment:
437
+ Description: 'Align elses and elsifs correctly.'
438
+ Enabled: true
439
+ VersionAdded: 0.49
440
+
293
441
  Layout/EmptyComment:
442
+ Description: 'Checks empty comment.'
443
+ Enabled: true
444
+ VersionAdded: 0.53
294
445
  AllowBorderComment: true
295
446
  AllowMarginComment: true
296
447
 
297
- # Use empty lines between defs.
448
+ Layout/EmptyLineAfterGuardClause:
449
+ Description: 'Add empty line after guard clause.'
450
+ Enabled: true
451
+ VersionAdded: 0.56
452
+ VersionChanged: 0.59
453
+
454
+ Layout/EmptyLineAfterMagicComment:
455
+ Description: 'Add an empty line after magic comments to separate them from code.'
456
+ StyleGuide: '#separate-magic-comments-from-code'
457
+ Enabled: true
458
+ VersionAdded: 0.49
459
+
298
460
  Layout/EmptyLineBetweenDefs:
461
+ Description: 'Use empty lines between defs.'
462
+ StyleGuide: '#empty-lines-between-methods'
463
+ Enabled: true
464
+ VersionAdded: 0.49
299
465
  # If `true`, this parameter means that single line method definitions don't
300
466
  # need an empty line between them.
301
467
  AllowAdjacentOneLineDefs: false
302
468
  # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
303
469
  NumberOfEmptyLines: 1
304
470
 
471
+ Layout/EmptyLines:
472
+ Description: "Don't use several empty lines in a row."
473
+ StyleGuide: '#two-or-more-empty-lines'
474
+ Enabled: true
475
+ VersionAdded: 0.49
476
+
477
+ Layout/EmptyLinesAroundAccessModifier:
478
+ Description: "Keep blank lines around access modifiers."
479
+ StyleGuide: '#empty-lines-around-access-modifier'
480
+ Enabled: true
481
+ VersionAdded: 0.49
482
+
483
+ Layout/EmptyLinesAroundArguments:
484
+ Description: "Keeps track of empty lines around method arguments."
485
+ Enabled: true
486
+ VersionAdded: 0.52
487
+
488
+ Layout/EmptyLinesAroundBeginBody:
489
+ Description: "Keeps track of empty lines around begin-end bodies."
490
+ StyleGuide: '#empty-lines-around-bodies'
491
+ Enabled: true
492
+ VersionAdded: 0.49
493
+
305
494
  Layout/EmptyLinesAroundBlockBody:
495
+ Description: "Keeps track of empty lines around block bodies."
496
+ StyleGuide: '#empty-lines-around-bodies'
497
+ Enabled: true
498
+ VersionAdded: 0.49
306
499
  EnforcedStyle: no_empty_lines
307
500
  SupportedStyles:
308
501
  - empty_lines
309
502
  - no_empty_lines
310
503
 
311
504
  Layout/EmptyLinesAroundClassBody:
505
+ Description: "Keeps track of empty lines around class bodies."
506
+ StyleGuide: '#empty-lines-around-bodies'
507
+ Enabled: true
508
+ VersionAdded: 0.49
509
+ VersionChanged: 0.53
312
510
  EnforcedStyle: no_empty_lines
313
511
  SupportedStyles:
314
512
  - empty_lines
@@ -318,7 +516,23 @@ Layout/EmptyLinesAroundClassBody:
318
516
  - beginning_only
319
517
  - ending_only
320
518
 
519
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
520
+ Description: "Keeps track of empty lines around exception handling keywords."
521
+ StyleGuide: '#empty-lines-around-bodies'
522
+ Enabled: true
523
+ VersionAdded: 0.49
524
+
525
+ Layout/EmptyLinesAroundMethodBody:
526
+ Description: "Keeps track of empty lines around method bodies."
527
+ StyleGuide: '#empty-lines-around-bodies'
528
+ Enabled: true
529
+ VersionAdded: 0.49
530
+
321
531
  Layout/EmptyLinesAroundModuleBody:
532
+ Description: "Keeps track of empty lines around module bodies."
533
+ StyleGuide: '#empty-lines-around-bodies'
534
+ Enabled: true
535
+ VersionAdded: 0.49
322
536
  EnforcedStyle: no_empty_lines
323
537
  SupportedStyles:
324
538
  - empty_lines
@@ -326,8 +540,10 @@ Layout/EmptyLinesAroundModuleBody:
326
540
  - empty_lines_special
327
541
  - no_empty_lines
328
542
 
329
- # Align ends correctly.
330
543
  Layout/EndAlignment:
544
+ Description: 'Align ends correctly.'
545
+ Enabled: true
546
+ VersionAdded: 0.53
331
547
  # The value `keyword` means that `end` should be aligned with the matching
332
548
  # keyword (`if`, `while`, etc.).
333
549
  # The value `variable` means that in assignments, `end` should be aligned
@@ -344,6 +560,10 @@ Layout/EndAlignment:
344
560
  Severity: warning
345
561
 
346
562
  Layout/EndOfLine:
563
+ Description: 'Use Unix-style line endings.'
564
+ StyleGuide: '#crlf'
565
+ Enabled: true
566
+ VersionAdded: 0.49
347
567
  # The `native` style means that CR+LF (Carriage Return + Line Feed) is
348
568
  # enforced on Windows, and LF is enforced on other platforms. The other styles
349
569
  # mean LF and CR+LF, respectively.
@@ -354,6 +574,9 @@ Layout/EndOfLine:
354
574
  - crlf
355
575
 
356
576
  Layout/ExtraSpacing:
577
+ Description: 'Do not use unnecessary spacing.'
578
+ Enabled: true
579
+ VersionAdded: 0.49
357
580
  # When true, allows most uses of extra spacing if the intent is to align
358
581
  # things with the previous or next line, not counting empty lines or comment
359
582
  # lines.
@@ -361,7 +584,39 @@ Layout/ExtraSpacing:
361
584
  # When true, forces the alignment of `=` in assignments on consecutive lines.
362
585
  ForceEqualSignAlignment: false
363
586
 
587
+ Layout/FirstArrayElementLineBreak:
588
+ Description: >-
589
+ Checks for a line break before the first element in a
590
+ multi-line array.
591
+ Enabled: false
592
+ VersionAdded: 0.49
593
+
594
+ Layout/FirstHashElementLineBreak:
595
+ Description: >-
596
+ Checks for a line break before the first element in a
597
+ multi-line hash.
598
+ Enabled: false
599
+ VersionAdded: 0.49
600
+
601
+ Layout/FirstMethodArgumentLineBreak:
602
+ Description: >-
603
+ Checks for a line break before the first argument in a
604
+ multi-line method call.
605
+ Enabled: false
606
+ VersionAdded: 0.49
607
+
608
+ Layout/FirstMethodParameterLineBreak:
609
+ Description: >-
610
+ Checks for a line break before the first parameter in a
611
+ multi-line method parameter definition.
612
+ Enabled: false
613
+ VersionAdded: 0.49
614
+
364
615
  Layout/FirstParameterIndentation:
616
+ Description: 'Checks the indentation of the first parameter in a method call.'
617
+ Enabled: true
618
+ VersionAdded: 0.49
619
+ VersionChanged: 0.56
365
620
  EnforcedStyle: special_for_inner_method_call_in_parentheses
366
621
  SupportedStyles:
367
622
  # The first parameter should always be indented one step more than the
@@ -382,25 +637,12 @@ Layout/FirstParameterIndentation:
382
637
  # But it can be overridden by setting this parameter
383
638
  IndentationWidth: ~
384
639
 
385
- Layout/IndentationConsistency:
386
- # The difference between `rails` and `normal` is that the `rails` style
387
- # prescribes that in classes and modules the `protected` and `private`
388
- # modifier keywords shall be indented the same as public methods and that
389
- # protected and private members shall be indented one step more than the
390
- # modifiers. Other than that, both styles mean that entities on the same
391
- # logical depth shall have the same indentation.
392
- EnforcedStyle: normal
393
- SupportedStyles:
394
- - normal
395
- - rails
396
-
397
- Layout/IndentationWidth:
398
- # Number of spaces for each indentation level.
399
- Width: 2
400
- IgnoredPatterns: []
401
-
402
- # Checks the indentation of the first element in an array literal.
403
640
  Layout/IndentArray:
641
+ Description: >-
642
+ Checks the indentation of the first element in an array
643
+ literal.
644
+ Enabled: true
645
+ VersionAdded: 0.49
404
646
  # The value `special_inside_parentheses` means that array literals with
405
647
  # brackets that have their opening bracket on the same line as a surrounding
406
648
  # opening round parenthesis, shall have their first element indented relative
@@ -421,14 +663,20 @@ Layout/IndentArray:
421
663
  # But it can be overridden by setting this parameter
422
664
  IndentationWidth: ~
423
665
 
424
- # Checks the indentation of assignment RHS, when on a different line from LHS
425
666
  Layout/IndentAssignment:
667
+ Description: >-
668
+ Checks the indentation of the first line of the
669
+ right-hand-side of a multi-line assignment.
670
+ Enabled: true
671
+ VersionAdded: 0.49
426
672
  # By default, the indentation width from `Layout/IndentationWidth` is used
427
673
  # But it can be overridden by setting this parameter
428
674
  IndentationWidth: ~
429
675
 
430
- # Checks the indentation of the first key in a hash literal.
431
676
  Layout/IndentHash:
677
+ Description: 'Checks the indentation of the first key in a hash literal.'
678
+ Enabled: true
679
+ VersionAdded: 0.49
432
680
  # The value `special_inside_parentheses` means that hash literals with braces
433
681
  # that have their opening brace on the same line as a surrounding opening
434
682
  # round parenthesis, shall have their first key indented relative to the
@@ -450,6 +698,10 @@ Layout/IndentHash:
450
698
  IndentationWidth: ~
451
699
 
452
700
  Layout/IndentHeredoc:
701
+ Description: 'This cop checks the indentation of the here document bodies.'
702
+ StyleGuide: '#squiggly-heredocs'
703
+ Enabled: true
704
+ VersionAdded: 0.49
453
705
  EnforcedStyle: auto_detection
454
706
  SupportedStyles:
455
707
  - auto_detection
@@ -458,13 +710,55 @@ Layout/IndentHeredoc:
458
710
  - powerpack
459
711
  - unindent
460
712
 
461
- Layout/SpaceInLambdaLiteral:
462
- EnforcedStyle: require_no_space
713
+ Layout/IndentationConsistency:
714
+ Description: 'Keep indentation straight.'
715
+ StyleGuide: '#spaces-indentation'
716
+ Enabled: true
717
+ VersionAdded: 0.49
718
+ # The difference between `rails` and `normal` is that the `rails` style
719
+ # prescribes that in classes and modules the `protected` and `private`
720
+ # modifier keywords shall be indented the same as public methods and that
721
+ # protected and private members shall be indented one step more than the
722
+ # modifiers. Other than that, both styles mean that entities on the same
723
+ # logical depth shall have the same indentation.
724
+ EnforcedStyle: normal
463
725
  SupportedStyles:
464
- - require_no_space
465
- - require_space
726
+ - normal
727
+ - rails
728
+
729
+ Layout/IndentationWidth:
730
+ Description: 'Use 2 spaces for indentation.'
731
+ StyleGuide: '#spaces-indentation'
732
+ Enabled: true
733
+ VersionAdded: 0.49
734
+ # Number of spaces for each indentation level.
735
+ Width: 2
736
+ IgnoredPatterns: []
737
+
738
+ Layout/InitialIndentation:
739
+ Description: >-
740
+ Checks the indentation of the first non-blank non-comment line in a file.
741
+ Enabled: true
742
+ VersionAdded: 0.49
743
+
744
+ Layout/LeadingBlankLines:
745
+ Description: Check for unnecessary blank lines at the beginning of a file.
746
+ Enabled: true
747
+ VersionAdded: 0.57
748
+
749
+ Layout/LeadingCommentSpace:
750
+ Description: 'Comments should start with a space.'
751
+ StyleGuide: '#hash-space'
752
+ Enabled: true
753
+ VersionAdded: 0.49
466
754
 
467
755
  Layout/MultilineArrayBraceLayout:
756
+ Description: >-
757
+ Checks that the closing brace in an array literal is
758
+ either on the same line as the last array element, or
759
+ a new line.
760
+ Enabled: true
761
+ VersionAdded: 0.49
468
762
  EnforcedStyle: symmetrical
469
763
  SupportedStyles:
470
764
  # symmetrical: closing brace is positioned in same way as opening brace
@@ -475,6 +769,10 @@ Layout/MultilineArrayBraceLayout:
475
769
  - same_line
476
770
 
477
771
  Layout/MultilineAssignmentLayout:
772
+ Description: 'Check for a newline after the assignment operator in multi-line assignments.'
773
+ StyleGuide: '#indent-conditional-assignment'
774
+ Enabled: false
775
+ VersionAdded: 0.49
478
776
  # The types of assignments which are subject to this rule.
479
777
  SupportedTypes:
480
778
  - block
@@ -492,7 +790,18 @@ Layout/MultilineAssignmentLayout:
492
790
  # for the set of supported types.
493
791
  - new_line
494
792
 
793
+ Layout/MultilineBlockLayout:
794
+ Description: 'Ensures newlines after multiline block do statements.'
795
+ Enabled: true
796
+ VersionAdded: 0.49
797
+
495
798
  Layout/MultilineHashBraceLayout:
799
+ Description: >-
800
+ Checks that the closing brace in a hash literal is
801
+ either on the same line as the last hash element, or
802
+ a new line.
803
+ Enabled: true
804
+ VersionAdded: 0.49
496
805
  EnforcedStyle: symmetrical
497
806
  SupportedStyles:
498
807
  # symmetrical: closing brace is positioned in same way as opening brace
@@ -503,6 +812,12 @@ Layout/MultilineHashBraceLayout:
503
812
  - same_line
504
813
 
505
814
  Layout/MultilineMethodCallBraceLayout:
815
+ Description: >-
816
+ Checks that the closing brace in a method call is
817
+ either on the same line as the last method argument, or
818
+ a new line.
819
+ Enabled: true
820
+ VersionAdded: 0.49
506
821
  EnforcedStyle: symmetrical
507
822
  SupportedStyles:
508
823
  # symmetrical: closing brace is positioned in same way as opening brace
@@ -513,6 +828,11 @@ Layout/MultilineMethodCallBraceLayout:
513
828
  - same_line
514
829
 
515
830
  Layout/MultilineMethodCallIndentation:
831
+ Description: >-
832
+ Checks indentation of method calls with the dot operator
833
+ that span more than one line.
834
+ Enabled: true
835
+ VersionAdded: 0.49
516
836
  EnforcedStyle: aligned
517
837
  SupportedStyles:
518
838
  - aligned
@@ -523,6 +843,12 @@ Layout/MultilineMethodCallIndentation:
523
843
  IndentationWidth: ~
524
844
 
525
845
  Layout/MultilineMethodDefinitionBraceLayout:
846
+ Description: >-
847
+ Checks that the closing brace in a method definition is
848
+ either on the same line as the last method parameter, or
849
+ a new line.
850
+ Enabled: true
851
+ VersionAdded: 0.49
526
852
  EnforcedStyle: symmetrical
527
853
  SupportedStyles:
528
854
  # symmetrical: closing brace is positioned in same way as opening brace
@@ -533,6 +859,11 @@ Layout/MultilineMethodDefinitionBraceLayout:
533
859
  - same_line
534
860
 
535
861
  Layout/MultilineOperationIndentation:
862
+ Description: >-
863
+ Checks indentation of binary operations that span more than
864
+ one line.
865
+ Enabled: true
866
+ VersionAdded: 0.49
536
867
  EnforcedStyle: aligned
537
868
  SupportedStyles:
538
869
  - aligned
@@ -541,25 +872,86 @@ Layout/MultilineOperationIndentation:
541
872
  # But it can be overridden by setting this parameter
542
873
  IndentationWidth: ~
543
874
 
875
+ Layout/RescueEnsureAlignment:
876
+ Description: 'Align rescues and ensures correctly.'
877
+ Enabled: true
878
+ VersionAdded: 0.49
879
+
880
+ Layout/SpaceAfterColon:
881
+ Description: 'Use spaces after colons.'
882
+ StyleGuide: '#spaces-operators'
883
+ Enabled: true
884
+ VersionAdded: 0.49
885
+
886
+ Layout/SpaceAfterComma:
887
+ Description: 'Use spaces after commas.'
888
+ StyleGuide: '#spaces-operators'
889
+ Enabled: true
890
+ VersionAdded: 0.49
891
+
892
+ Layout/SpaceAfterMethodName:
893
+ Description: >-
894
+ Do not put a space between a method name and the opening
895
+ parenthesis in a method definition.
896
+ StyleGuide: '#parens-no-spaces'
897
+ Enabled: true
898
+ VersionAdded: 0.49
899
+
900
+ Layout/SpaceAfterNot:
901
+ Description: Tracks redundant space after the ! operator.
902
+ StyleGuide: '#no-space-bang'
903
+ Enabled: true
904
+ VersionAdded: 0.49
905
+
906
+ Layout/SpaceAfterSemicolon:
907
+ Description: 'Use spaces after semicolons.'
908
+ StyleGuide: '#spaces-operators'
909
+ Enabled: true
910
+ VersionAdded: 0.49
911
+
544
912
  Layout/SpaceAroundBlockParameters:
913
+ Description: 'Checks the spacing inside and after block parameters pipes.'
914
+ Enabled: true
915
+ VersionAdded: 0.49
545
916
  EnforcedStyleInsidePipes: no_space
546
917
  SupportedStylesInsidePipes:
547
918
  - space
548
919
  - no_space
549
920
 
550
921
  Layout/SpaceAroundEqualsInParameterDefault:
922
+ Description: >-
923
+ Checks that the equals signs in parameter default assignments
924
+ have or don't have surrounding space depending on
925
+ configuration.
926
+ StyleGuide: '#spaces-around-equals'
927
+ Enabled: true
928
+ VersionAdded: 0.49
551
929
  EnforcedStyle: space
552
930
  SupportedStyles:
553
931
  - space
554
932
  - no_space
555
933
 
934
+ Layout/SpaceAroundKeyword:
935
+ Description: 'Use a space around keywords if appropriate.'
936
+ Enabled: true
937
+ VersionAdded: 0.49
938
+
556
939
  Layout/SpaceAroundOperators:
940
+ Description: 'Use a single space around operators.'
941
+ StyleGuide: '#spaces-operators'
942
+ Enabled: true
943
+ VersionAdded: 0.49
557
944
  # When `true`, allows most uses of extra spacing if the intent is to align
558
945
  # with an operator on the previous or next line, not counting empty lines
559
946
  # or comment lines.
560
947
  AllowForAlignment: true
561
948
 
562
949
  Layout/SpaceBeforeBlockBraces:
950
+ Description: >-
951
+ Checks that the left block brace has or doesn't have space
952
+ before it.
953
+ Enabled: true
954
+ VersionAdded: 0.49
563
955
  EnforcedStyle: space
564
956
  SupportedStyles:
565
957
  - space
@@ -568,14 +960,49 @@ Layout/SpaceBeforeBlockBraces:
568
960
  SupportedStylesForEmptyBraces:
569
961
  - space
570
962
  - no_space
963
+ VersionChanged: 0.52.1
964
+
965
+ Layout/SpaceBeforeComma:
966
+ Description: 'No spaces before commas.'
967
+ Enabled: true
968
+ VersionAdded: 0.49
969
+
970
+ Layout/SpaceBeforeComment:
971
+ Description: >-
972
+ Checks for missing space between code and a comment on the
973
+ same line.
974
+ Enabled: true
975
+ VersionAdded: 0.49
571
976
 
572
977
  Layout/SpaceBeforeFirstArg:
978
+ Description: >-
979
+ Checks that exactly one space is used between a method name
980
+ and the first argument for method calls without parentheses.
981
+ Enabled: true
982
+ VersionAdded: 0.49
573
983
  # When `true`, allows most uses of extra spacing if the intent is to align
574
984
  # things with the previous or next line, not counting empty lines or comment
575
985
  # lines.
576
986
  AllowForAlignment: true
577
987
 
988
+ Layout/SpaceBeforeSemicolon:
989
+ Description: 'No spaces before semicolons.'
990
+ Enabled: true
991
+ VersionAdded: 0.49
992
+
993
+ Layout/SpaceInLambdaLiteral:
994
+ Description: 'Checks for spaces in lambda literals.'
995
+ Enabled: true
996
+ VersionAdded: 0.49
997
+ EnforcedStyle: require_no_space
998
+ SupportedStyles:
999
+ - require_no_space
1000
+ - require_space
1001
+
578
1002
  Layout/SpaceInsideArrayLiteralBrackets:
1003
+ Description: 'Checks the spacing inside array literal brackets.'
1004
+ Enabled: true
1005
+ VersionAdded: 0.52
579
1006
  EnforcedStyle: no_space
580
1007
  SupportedStyles:
581
1008
  - space
@@ -588,7 +1015,18 @@ Layout/SpaceInsideArrayLiteralBrackets:
588
1015
  - space
589
1016
  - no_space
590
1017
 
1018
+ Layout/SpaceInsideArrayPercentLiteral:
1019
+ Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
1020
+ Enabled: true
1021
+ VersionAdded: 0.49
1022
+
591
1023
  Layout/SpaceInsideBlockBraces:
1024
+ Description: >-
1025
+ Checks that block braces have or don't have surrounding space.
1026
+ For blocks taking parameters, checks that the left brace has
1027
+ or doesn't have trailing space.
1028
+ Enabled: true
1029
+ VersionAdded: 0.49
592
1030
  EnforcedStyle: space
593
1031
  SupportedStyles:
594
1032
  - space
@@ -601,6 +1039,10 @@ Layout/SpaceInsideBlockBraces:
601
1039
  SpaceBeforeBlockParameters: true
602
1040
 
603
1041
  Layout/SpaceInsideHashLiteralBraces:
1042
+ Description: "Use spaces inside hash literal braces - or don't."
1043
+ StyleGuide: '#spaces-operators'
1044
+ Enabled: true
1045
+ VersionAdded: 0.49
604
1046
  EnforcedStyle: space
605
1047
  SupportedStyles:
606
1048
  - space
@@ -613,13 +1055,34 @@ Layout/SpaceInsideHashLiteralBraces:
613
1055
  - space
614
1056
  - no_space
615
1057
 
1058
+
616
1059
  Layout/SpaceInsideParens:
1060
+ Description: 'No spaces after ( or before ).'
1061
+ StyleGuide: '#spaces-braces'
1062
+ Enabled: true
1063
+ VersionAdded: 0.49
1064
+ VersionChanged: 0.55
617
1065
  EnforcedStyle: no_space
618
1066
  SupportedStyles:
619
1067
  - space
620
1068
  - no_space
621
1069
 
1070
+ Layout/SpaceInsidePercentLiteralDelimiters:
1071
+ Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
1072
+ Enabled: true
1073
+ VersionAdded: 0.49
1074
+
1075
+ Layout/SpaceInsideRangeLiteral:
1076
+ Description: 'No spaces inside range literals.'
1077
+ StyleGuide: '#no-space-inside-range-literals'
1078
+ Enabled: true
1079
+ VersionAdded: 0.49
1080
+
622
1081
  Layout/SpaceInsideReferenceBrackets:
1082
+ Description: 'Checks the spacing inside referential brackets.'
1083
+ Enabled: true
1084
+ VersionAdded: 0.52
1085
+ VersionChanged: 0.53
623
1086
  EnforcedStyle: no_space
624
1087
  SupportedStyles:
625
1088
  - space
@@ -630,27 +1093,21 @@ Layout/SpaceInsideReferenceBrackets:
630
1093
  - no_space
631
1094
 
632
1095
  Layout/SpaceInsideStringInterpolation:
1096
+ Description: 'Checks for padding/surrounding spaces inside string interpolation.'
1097
+ StyleGuide: '#string-interpolation'
1098
+ Enabled: true
1099
+ VersionAdded: 0.49
633
1100
  EnforcedStyle: no_space
634
1101
  SupportedStyles:
635
1102
  - space
636
1103
  - no_space
637
1104
 
638
- Layout/ClassStructure:
639
- Categories:
640
- module_inclusion:
641
- - include
642
- - prepend
643
- - extend
644
- ExpectedOrder:
645
- - module_inclusion
646
- - constants
647
- - public_class_methods
648
- - initializer
649
- - public_methods
650
- - protected_methods
651
- - private_methods
652
-
653
1105
  Layout/Tab:
1106
+ Description: 'No hard tabs.'
1107
+ StyleGuide: '#spaces-indentation'
1108
+ Enabled: true
1109
+ VersionAdded: 0.49
1110
+ VersionChanged: 0.51
654
1111
  # By default, the indentation width from Layout/IndentationWidth is used
655
1112
  # But it can be overridden by setting this parameter
656
1113
  # It is used during auto-correction to determine how many spaces should
@@ -658,133 +1115,796 @@ Layout/Tab:
658
1115
  IndentationWidth: ~
659
1116
 
660
1117
  Layout/TrailingBlankLines:
1118
+ Description: 'Checks trailing blank lines and final newline.'
1119
+ StyleGuide: '#newline-eof'
1120
+ Enabled: true
1121
+ VersionAdded: 0.49
661
1122
  EnforcedStyle: final_newline
662
1123
  SupportedStyles:
663
1124
  - final_newline
664
1125
  - final_blank_line
665
1126
 
666
1127
  Layout/TrailingWhitespace:
1128
+ Description: 'Avoid trailing whitespace.'
1129
+ StyleGuide: '#no-trailing-whitespace'
1130
+ Enabled: true
1131
+ VersionAdded: 0.49
1132
+ VersionChanged: 0.55
667
1133
  AllowInHeredoc: false
668
1134
 
669
- #################### Naming ##########################
670
-
671
- Naming/FileName:
672
- # Camel case file names listed in `AllCops:Include` and all file names listed
673
- # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
674
- Exclude: []
675
- # When `true`, requires that each source file should define a class or module
676
- # with a name which matches the file name (converted to ... case).
677
- # It further expects it to be nested inside modules which match the names
678
- # of subdirectories in its path.
679
- ExpectMatchingDefinition: false
680
- # If non-`nil`, expect all source file names to match the following regex.
681
- # Only the file name itself is matched, not the entire file path.
682
- # Use anchors as necessary if you want to match the entire name rather than
683
- # just a part of it.
684
- Regex: ~
685
- # With `IgnoreExecutableScripts` set to `true`, this cop does not
686
- # report offending filenames for executable scripts (i.e. source
687
- # files with a shebang in the first line).
688
- IgnoreExecutableScripts: true
689
- AllowedAcronyms:
690
- - CLI
691
- - DSL
692
- - ACL
693
- - API
694
- - ASCII
695
- - CPU
696
- - CSS
697
- - DNS
698
- - EOF
699
- - GUID
700
- - HTML
701
- - HTTP
702
- - HTTPS
703
- - ID
704
- - IP
705
- - JSON
706
- - LHS
707
- - QPS
708
- - RAM
709
- - RHS
710
- - RPC
711
- - SLA
712
- - SMTP
713
- - SQL
714
- - SSH
715
- - TCP
716
- - TLS
717
- - TTL
718
- - UDP
719
- - UI
720
- - UID
721
- - UUID
722
- - URI
723
- - URL
724
- - UTF8
725
- - VM
726
- - XML
727
- - XMPP
728
- - XSRF
729
- - XSS
1135
+ #################### Lint ##################################
1136
+ ### Warnings
1137
+
1138
+ Lint/AmbiguousBlockAssociation:
1139
+ Description: >-
1140
+ Checks for ambiguous block association with method when param passed without
1141
+ parentheses.
1142
+ StyleGuide: '#syntax'
1143
+ Enabled: true
1144
+ VersionAdded: 0.48
1145
+
1146
+ Lint/AmbiguousOperator:
1147
+ Description: >-
1148
+ Checks for ambiguous operators in the first argument of a
1149
+ method invocation without parentheses.
1150
+ StyleGuide: '#method-invocation-parens'
1151
+ Enabled: true
1152
+ VersionAdded: 0.17
1153
+
1154
+ Lint/AmbiguousRegexpLiteral:
1155
+ Description: >-
1156
+ Checks for ambiguous regexp literals in the first argument of
1157
+ a method invocation without parentheses.
1158
+ Enabled: true
1159
+ VersionAdded: 0.17
730
1160
 
731
- Naming/HeredocDelimiterNaming:
732
- Blacklist:
733
- - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
1161
+ Lint/AssignmentInCondition:
1162
+ Description: "Don't use assignment in conditions."
1163
+ StyleGuide: '#safe-assignment-in-condition'
1164
+ Enabled: true
1165
+ VersionAdded: 0.9
1166
+ AllowSafeAssignment: true
734
1167
 
735
- Naming/HeredocDelimiterCase:
736
- EnforcedStyle: uppercase
737
- SupportedStyles:
738
- - lowercase
739
- - uppercase
1168
+ Lint/BigDecimalNew:
1169
+ Description: '`BigDecimal.new()` is deprecated. Use `BigDecimal()` instead.'
1170
+ Enabled: true
1171
+ VersionAdded: 0.53
1172
+
1173
+ Lint/BooleanSymbol:
1174
+ Description: 'Check for `:true` and `:false` symbols.'
1175
+ Enabled: true
1176
+ VersionAdded: 0.50
1177
+
1178
+ Lint/CircularArgumentReference:
1179
+ Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
1180
+ Enabled: true
1181
+ VersionAdded: 0.33
1182
+
1183
+ Lint/Debugger:
1184
+ Description: 'Check for debugger calls.'
1185
+ Enabled: true
1186
+ VersionAdded: 0.14
1187
+ VersionChanged: 0.49
1188
+
1189
+ Lint/DeprecatedClassMethods:
1190
+ Description: 'Check for deprecated class method calls.'
1191
+ Enabled: true
1192
+ VersionAdded: 0.19
1193
+
1194
+ Lint/DuplicateCaseCondition:
1195
+ Description: 'Do not repeat values in case conditionals.'
1196
+ Enabled: true
1197
+ VersionAdded: 0.45
1198
+
1199
+ Lint/DuplicateMethods:
1200
+ Description: 'Check for duplicate method definitions.'
1201
+ Enabled: true
1202
+ VersionAdded: 0.29
1203
+
1204
+ Lint/DuplicatedKey:
1205
+ Description: 'Check for duplicate keys in hash literals.'
1206
+ Enabled: true
1207
+ VersionAdded: 0.34
1208
+
1209
+ Lint/EachWithObjectArgument:
1210
+ Description: 'Check for immutable argument given to each_with_object.'
1211
+ Enabled: true
1212
+ VersionAdded: 0.31
1213
+
1214
+ Lint/ElseLayout:
1215
+ Description: 'Check for odd code arrangement in an else block.'
1216
+ Enabled: true
1217
+ VersionAdded: 0.17
1218
+
1219
+ Lint/EmptyEnsure:
1220
+ Description: 'Checks for empty ensure block.'
1221
+ Enabled: true
1222
+ VersionAdded: 0.10
1223
+ VersionChanged: 0.48
1224
+ AutoCorrect: false
740
1225
 
741
- Naming/MemoizedInstanceVariableName:
742
- EnforcedStyleForLeadingUnderscores: disallowed
743
- SupportedStylesForLeadingUnderscores:
744
- - disallowed
745
- - required
746
- - optional
1226
+ Lint/EmptyExpression:
1227
+ Description: 'Checks for empty expressions.'
1228
+ Enabled: true
1229
+ VersionAdded: 0.45
1230
+
1231
+ Lint/EmptyInterpolation:
1232
+ Description: 'Checks for empty string interpolation.'
1233
+ Enabled: true
1234
+ VersionAdded: 0.20
1235
+ VersionChanged: 0.45
1236
+
1237
+ Lint/EmptyWhen:
1238
+ Description: 'Checks for `when` branches with empty bodies.'
1239
+ Enabled: true
1240
+ VersionAdded: 0.45
1241
+
1242
+ Lint/EndInMethod:
1243
+ Description: 'END blocks should not be placed inside method definitions.'
1244
+ Enabled: true
1245
+ VersionAdded: 0.9
1246
+
1247
+ Lint/EnsureReturn:
1248
+ Description: 'Do not use return in an ensure block.'
1249
+ StyleGuide: '#no-return-ensure'
1250
+ Enabled: true
1251
+ VersionAdded: 0.9
1252
+
1253
+ Lint/ErbNewArguments:
1254
+ Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
1255
+ Enabled: true
1256
+ VersionAdded: 0.56
1257
+
1258
+ Lint/FloatOutOfRange:
1259
+ Description: >-
1260
+ Catches floating-point literals too large or small for Ruby to
1261
+ represent.
1262
+ Enabled: true
1263
+ VersionAdded: 0.36
1264
+
1265
+ Lint/FormatParameterMismatch:
1266
+ Description: 'The number of parameters to format/sprint must match the fields.'
1267
+ Enabled: true
1268
+ VersionAdded: 0.33
1269
+
1270
+ Lint/HandleExceptions:
1271
+ Description: "Don't suppress exception."
1272
+ StyleGuide: '#dont-hide-exceptions'
1273
+ Enabled: true
1274
+ VersionAdded: 0.9
1275
+
1276
+ Lint/ImplicitStringConcatenation:
1277
+ Description: >-
1278
+ Checks for adjacent string literals on the same line, which
1279
+ could better be represented as a single string literal.
1280
+ Enabled: true
1281
+ VersionAdded: 0.36
1282
+
1283
+ Lint/IneffectiveAccessModifier:
1284
+ Description: >-
1285
+ Checks for attempts to use `private` or `protected` to set
1286
+ the visibility of a class method, which does not work.
1287
+ Enabled: true
1288
+ VersionAdded: 0.36
747
1289
 
748
- Naming/MethodName:
749
- EnforcedStyle: snake_case
1290
+ Lint/InheritException:
1291
+ Description: 'Avoid inheriting from the `Exception` class.'
1292
+ Enabled: true
1293
+ VersionAdded: 0.41
1294
+ # The default base class in favour of `Exception`.
1295
+ EnforcedStyle: runtime_error
750
1296
  SupportedStyles:
751
- - snake_case
752
- - camelCase
1297
+ - runtime_error
1298
+ - standard_error
753
1299
 
754
- Naming/PredicateName:
755
- # Predicate name prefixes.
756
- NamePrefix:
757
- - is_
758
- - has_
759
- - have_
760
- # Predicate name prefixes that should be removed.
761
- NamePrefixBlacklist:
762
- - is_
763
- - has_
764
- - have_
765
- # Predicate names which, despite having a blacklisted prefix, or no `?`,
766
- # should still be accepted
767
- NameWhitelist:
768
- - is_a?
769
- # Method definition macros for dynamically generated methods.
770
- MethodDefinitionMacros:
771
- - define_method
772
- - define_singleton_method
773
- # Exclude Rspec specs because there is a strong convention to write spec
774
- # helpers in the form of `have_something` or `be_something`.
775
- Exclude:
776
- - 'spec/**/*'
1300
+ Lint/InterpolationCheck:
1301
+ Description: 'Raise warning for interpolation in single q strs'
1302
+ Enabled: true
1303
+ VersionAdded: 0.50
1304
+
1305
+ Lint/LiteralAsCondition:
1306
+ Description: 'Checks of literals used in conditions.'
1307
+ Enabled: true
1308
+ VersionAdded: 0.51
1309
+
1310
+ Lint/LiteralInInterpolation:
1311
+ Description: 'Checks for literals used in interpolation.'
1312
+ Enabled: true
1313
+ VersionAdded: 0.19
1314
+ VersionChanged: 0.32
1315
+
1316
+ Lint/Loop:
1317
+ Description: >-
1318
+ Use Kernel#loop with break rather than begin/end/until or
1319
+ begin/end/while for post-loop tests.
1320
+ StyleGuide: '#loop-with-break'
1321
+ Enabled: true
1322
+ VersionAdded: 0.9
777
1323
 
778
- Naming/UncommunicativeBlockParamName:
779
- # Parameter names may be equal to or greater than this value
780
- MinNameLength: 1
781
- AllowNamesEndingInNumbers: true
782
- # Whitelisted names that will not register an offense
783
- AllowedNames: []
784
- # Blacklisted names that will register an offense
785
- ForbiddenNames: []
1324
+ Lint/MissingCopEnableDirective:
1325
+ Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
1326
+ Enabled: true
1327
+ VersionAdded: 0.52
1328
+ # Maximum number of consecutive lines the cop can be disabled for.
1329
+ # 0 allows only single-line disables
1330
+ # 1 would mean the maximum allowed is the following:
1331
+ # # rubocop:disable SomeCop
1332
+ # a = 1
1333
+ # # rubocop:enable SomeCop
1334
+ # .inf for any size
1335
+ MaximumRangeSize: .inf
786
1336
 
787
- Naming/UncommunicativeMethodParamName:
1337
+ Lint/MultipleCompare:
1338
+ Description: "Use `&&` operator to compare multiple value."
1339
+ Enabled: true
1340
+ VersionAdded: 0.47
1341
+
1342
+ Lint/NestedMethodDefinition:
1343
+ Description: 'Do not use nested method definitions.'
1344
+ StyleGuide: '#no-nested-methods'
1345
+ Enabled: true
1346
+ VersionAdded: 0.32
1347
+
1348
+ Lint/NestedPercentLiteral:
1349
+ Description: 'Checks for nested percent literals.'
1350
+ Enabled: true
1351
+ VersionAdded: 0.52
1352
+
1353
+ Lint/NextWithoutAccumulator:
1354
+ Description: >-
1355
+ Do not omit the accumulator when calling `next`
1356
+ in a `reduce`/`inject` block.
1357
+ Enabled: true
1358
+ VersionAdded: 0.36
1359
+
1360
+ Lint/NonLocalExitFromIterator:
1361
+ Description: 'Do not use return in iterator to cause non-local exit.'
1362
+ Enabled: true
1363
+ VersionAdded: 0.30
1364
+
1365
+ Lint/NumberConversion:
1366
+ Description: 'Checks unsafe usage of number conversion methods.'
1367
+ Enabled: false
1368
+ VersionAdded: 0.53
1369
+
1370
+ Lint/OrderedMagicComments:
1371
+ Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1372
+ Enabled: true
1373
+ VersionAdded: 0.53
1374
+
1375
+ Lint/ParenthesesAsGroupedExpression:
1376
+ Description: >-
1377
+ Checks for method calls with a space before the opening
1378
+ parenthesis.
1379
+ StyleGuide: '#parens-no-spaces'
1380
+ Enabled: true
1381
+ VersionAdded: 0.12
1382
+
1383
+ Lint/PercentStringArray:
1384
+ Description: >-
1385
+ Checks for unwanted commas and quotes in %w/%W literals.
1386
+ Enabled: true
1387
+ VersionAdded: 0.41
1388
+
1389
+ Lint/PercentSymbolArray:
1390
+ Description: >-
1391
+ Checks for unwanted commas and colons in %i/%I literals.
1392
+ Enabled: true
1393
+ VersionAdded: 0.41
1394
+
1395
+ Lint/RandOne:
1396
+ Description: >-
1397
+ Checks for `rand(1)` calls. Such calls always return `0`
1398
+ and most likely a mistake.
1399
+ Enabled: true
1400
+ VersionAdded: 0.36
1401
+
1402
+ Lint/RedundantWithIndex:
1403
+ Description: 'Checks for redundant `with_index`.'
1404
+ Enabled: true
1405
+ VersionAdded: 0.50
1406
+
1407
+ Lint/RedundantWithObject:
1408
+ Description: 'Checks for redundant `with_object`.'
1409
+ Enabled: true
1410
+ VersionAdded: 0.51
1411
+
1412
+ Lint/RegexpAsCondition:
1413
+ Description: >-
1414
+ Do not use regexp literal as a condition.
1415
+ The regexp literal matches `$_` implicitly.
1416
+ Enabled: true
1417
+ VersionAdded: 0.51
1418
+
1419
+ Lint/RequireParentheses:
1420
+ Description: >-
1421
+ Use parentheses in the method call to avoid confusion
1422
+ about precedence.
1423
+ Enabled: true
1424
+ VersionAdded: 0.18
1425
+
1426
+ Lint/RescueException:
1427
+ Description: 'Avoid rescuing the Exception class.'
1428
+ StyleGuide: '#no-blind-rescues'
1429
+ Enabled: true
1430
+ VersionAdded: 0.9
1431
+ VersionChanged: 0.27.1
1432
+
1433
+ Lint/RescueType:
1434
+ Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
1435
+ Enabled: true
1436
+ VersionAdded: 0.49
1437
+
1438
+ Lint/ReturnInVoidContext:
1439
+ Description: 'Checks for return in void context.'
1440
+ Enabled: true
1441
+ VersionAdded: 0.50
1442
+
1443
+ Lint/SafeNavigationChain:
1444
+ Description: 'Do not chain ordinary method call after safe navigation operator.'
1445
+ Enabled: true
1446
+ VersionAdded: 0.47
1447
+ VersionChanged: 0.56
1448
+ Whitelist:
1449
+ - present?
1450
+ - blank?
1451
+ - presence
1452
+ - try
1453
+ - try!
1454
+
1455
+ Lint/SafeNavigationConsistency:
1456
+ Description: >-
1457
+ Check to make sure that if safe navigation is used for a method
1458
+ call in an `&&` or `||` condition that safe navigation is used
1459
+ for all method calls on that same object.
1460
+ Enabled: true
1461
+ VersionAdded: 0.55
1462
+ Whitelist:
1463
+ - present?
1464
+ - blank?
1465
+ - presence
1466
+ - try
1467
+ - try!
1468
+
1469
+
1470
+ Lint/ScriptPermission:
1471
+ Description: 'Grant script file execute permission.'
1472
+ Enabled: true
1473
+ VersionAdded: 0.49
1474
+ VersionChanged: 0.50
1475
+
1476
+ Lint/ShadowedArgument:
1477
+ Description: 'Avoid reassigning arguments before they were used.'
1478
+ Enabled: true
1479
+ VersionAdded: 0.52
1480
+ IgnoreImplicitReferences: false
1481
+
1482
+
1483
+ Lint/ShadowedException:
1484
+ Description: >-
1485
+ Avoid rescuing a higher level exception
1486
+ before a lower level exception.
1487
+ Enabled: true
1488
+ VersionAdded: 0.41
1489
+
1490
+ Lint/ShadowingOuterLocalVariable:
1491
+ Description: >-
1492
+ Do not use the same name as outer local variable
1493
+ for block arguments or block local variables.
1494
+ Enabled: true
1495
+ VersionAdded: 0.9
1496
+
1497
+ Lint/StringConversionInInterpolation:
1498
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1499
+ StyleGuide: '#no-to-s'
1500
+ Enabled: true
1501
+ VersionAdded: 0.19
1502
+ VersionChanged: 0.20
1503
+
1504
+ Lint/Syntax:
1505
+ Description: 'Checks syntax error'
1506
+ Enabled: true
1507
+ VersionAdded: 0.9
1508
+
1509
+
1510
+ Lint/UnderscorePrefixedVariableName:
1511
+ Description: 'Do not use prefix `_` for a variable that is used.'
1512
+ Enabled: true
1513
+ VersionAdded: 0.21
1514
+
1515
+ Lint/UnifiedInteger:
1516
+ Description: 'Use Integer instead of Fixnum or Bignum'
1517
+ Enabled: true
1518
+ VersionAdded: 0.43
1519
+
1520
+ Lint/UnneededCopDisableDirective:
1521
+ Description: >-
1522
+ Checks for rubocop:disable comments that can be removed.
1523
+ Note: this cop is not disabled when disabling all cops.
1524
+ It must be explicitly disabled.
1525
+ Enabled: true
1526
+ VersionAdded: 0.53
1527
+
1528
+ Lint/UnneededCopEnableDirective:
1529
+ Description: Checks for rubocop:enable comments that can be removed.
1530
+ Enabled: true
1531
+ VersionAdded: 0.53
1532
+
1533
+ Lint/UnneededRequireStatement:
1534
+ Description: 'Checks for unnecessary `require` statement.'
1535
+ Enabled: true
1536
+ VersionAdded: 0.51
1537
+
1538
+ Lint/UnneededSplatExpansion:
1539
+ Description: 'Checks for splat unnecessarily being called on literals'
1540
+ Enabled: true
1541
+ VersionAdded: 0.43
1542
+
1543
+ Lint/UnreachableCode:
1544
+ Description: 'Unreachable code.'
1545
+ Enabled: true
1546
+ VersionAdded: 0.9
1547
+
1548
+ Lint/UnusedBlockArgument:
1549
+ Description: 'Checks for unused block arguments.'
1550
+ StyleGuide: '#underscore-unused-vars'
1551
+ Enabled: true
1552
+ VersionAdded: 0.21
1553
+ VersionChanged: 0.22
1554
+ IgnoreEmptyBlocks: true
1555
+ AllowUnusedKeywordArguments: false
1556
+
1557
+ Lint/UnusedMethodArgument:
1558
+ Description: 'Checks for unused method arguments.'
1559
+ StyleGuide: '#underscore-unused-vars'
1560
+ Enabled: true
1561
+ VersionAdded: 0.21
1562
+ VersionChanged: 0.35
1563
+ AllowUnusedKeywordArguments: false
1564
+ IgnoreEmptyMethods: true
1565
+
1566
+ Lint/UriEscapeUnescape:
1567
+ Description: >-
1568
+ `URI.escape` method is obsolete and should not be used. Instead, use
1569
+ `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
1570
+ depending on your specific use case.
1571
+ Also `URI.unescape` method is obsolete and should not be used. Instead, use
1572
+ `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
1573
+ depending on your specific use case.
1574
+ Enabled: true
1575
+ VersionAdded: 0.50
1576
+
1577
+ Lint/UriRegexp:
1578
+ Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
1579
+ Enabled: true
1580
+ VersionAdded: 0.50
1581
+
1582
+ Lint/UselessAccessModifier:
1583
+ Description: 'Checks for useless access modifiers.'
1584
+ Enabled: true
1585
+ VersionAdded: 0.20
1586
+ VersionChanged: 0.47
1587
+ ContextCreatingMethods: []
1588
+ MethodCreatingMethods: []
1589
+
1590
+ Lint/UselessAssignment:
1591
+ Description: 'Checks for useless assignment to a local variable.'
1592
+ StyleGuide: '#underscore-unused-vars'
1593
+ Enabled: true
1594
+ VersionAdded: 0.11
1595
+
1596
+ Lint/UselessComparison:
1597
+ Description: 'Checks for comparison of something with itself.'
1598
+ Enabled: true
1599
+ VersionAdded: 0.11
1600
+
1601
+ Lint/UselessElseWithoutRescue:
1602
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1603
+ Enabled: true
1604
+ VersionAdded: 0.17
1605
+
1606
+ Lint/UselessSetterCall:
1607
+ Description: 'Checks for useless setter call to a local variable.'
1608
+ Enabled: true
1609
+ VersionAdded: 0.13
1610
+
1611
+ Lint/Void:
1612
+ Description: 'Possible use of operator/literal/variable in void context.'
1613
+ Enabled: true
1614
+ VersionAdded: 0.9
1615
+ CheckForMethodsWithNoSideEffects: false
1616
+
1617
+ #################### Metrics ###############################
1618
+
1619
+ Metrics/AbcSize:
1620
+ Description: >-
1621
+ A calculated magnitude based on number of assignments,
1622
+ branches, and conditions.
1623
+ Reference: 'http://c2.com/cgi/wiki?AbcMetric'
1624
+ Enabled: true
1625
+ VersionAdded: 0.27
1626
+ # The ABC size is a calculated magnitude, so this number can be an Integer or
1627
+ # a Float.
1628
+ Max: 15
1629
+
1630
+ Metrics/BlockLength:
1631
+ Description: 'Avoid long blocks with many lines.'
1632
+ Enabled: true
1633
+ VersionAdded: 0.44
1634
+ VersionChanged: 0.58
1635
+ CountComments: false # count full line comments?
1636
+ Max: 25
1637
+ ExcludedMethods:
1638
+ # By default, exclude the `#refine` method, as it tends to have larger
1639
+ # associated blocks.
1640
+ - refine
1641
+
1642
+ Metrics/BlockNesting:
1643
+ Description: 'Avoid excessive block nesting'
1644
+ StyleGuide: '#three-is-the-number-thou-shalt-count'
1645
+ Enabled: true
1646
+ VersionAdded: 0.25
1647
+ VersionChanged: 0.47
1648
+ CountBlocks: false
1649
+ Max: 3
1650
+
1651
+ Metrics/ClassLength:
1652
+ Description: 'Avoid classes longer than 100 lines of code.'
1653
+ Enabled: true
1654
+ VersionAdded: 0.25
1655
+ CountComments: false # count full line comments?
1656
+ Max: 100
1657
+
1658
+ # Avoid complex methods.
1659
+ Metrics/CyclomaticComplexity:
1660
+ Description: >-
1661
+ A complexity metric that is strongly correlated to the number
1662
+ of test cases needed to validate a method.
1663
+ Enabled: true
1664
+ VersionAdded: 0.25
1665
+ Max: 6
1666
+
1667
+ Metrics/LineLength:
1668
+ Description: 'Limit lines to 80 characters.'
1669
+ StyleGuide: '#80-character-limits'
1670
+ Enabled: true
1671
+ VersionAdded: 0.25
1672
+ VersionChanged: 0.46
1673
+ Max: 80
1674
+ # To make it possible to copy or click on URIs in the code, we allow lines
1675
+ # containing a URI to be longer than Max.
1676
+ AllowHeredoc: true
1677
+ AllowURI: true
1678
+ URISchemes:
1679
+ - http
1680
+ - https
1681
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1682
+ # directives like '# rubocop: enable ...' when calculating a line's length.
1683
+ IgnoreCopDirectives: false
1684
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1685
+ # elements. Strings will be converted to Regexp objects. A line that matches
1686
+ # any regular expression listed in this option will be ignored by LineLength.
1687
+ IgnoredPatterns: []
1688
+
1689
+ Metrics/MethodLength:
1690
+ Description: 'Avoid methods longer than 10 lines of code.'
1691
+ StyleGuide: '#short-methods'
1692
+ Enabled: true
1693
+ VersionAdded: 0.25
1694
+ VersionChanged: 0.59.2
1695
+ CountComments: false # count full line comments?
1696
+ Max: 10
1697
+ ExcludedMethods: []
1698
+
1699
+ Metrics/ModuleLength:
1700
+ Description: 'Avoid modules longer than 100 lines of code.'
1701
+ Enabled: true
1702
+ VersionAdded: 0.31
1703
+ CountComments: false # count full line comments?
1704
+ Max: 100
1705
+
1706
+ Metrics/ParameterLists:
1707
+ Description: 'Avoid parameter lists longer than three or four parameters.'
1708
+ StyleGuide: '#too-many-params'
1709
+ Enabled: true
1710
+ VersionAdded: 0.25
1711
+ Max: 5
1712
+ CountKeywordArgs: true
1713
+
1714
+ Metrics/PerceivedComplexity:
1715
+ Description: >-
1716
+ A complexity metric geared towards measuring complexity for a
1717
+ human reader.
1718
+ Enabled: true
1719
+ VersionAdded: 0.25
1720
+ Max: 7
1721
+
1722
+ #################### Naming ##############################
1723
+
1724
+ Naming/AccessorMethodName:
1725
+ Description: Check the naming of accessor methods for get_/set_.
1726
+ StyleGuide: '#accessor_mutator_method_names'
1727
+ Enabled: true
1728
+ VersionAdded: 0.50
1729
+
1730
+ Naming/AsciiIdentifiers:
1731
+ Description: 'Use only ascii symbols in identifiers.'
1732
+ StyleGuide: '#english-identifiers'
1733
+ Enabled: true
1734
+ VersionAdded: 0.50
1735
+
1736
+ Naming/BinaryOperatorParameterName:
1737
+ Description: 'When defining binary operators, name the argument other.'
1738
+ StyleGuide: '#other-arg'
1739
+ Enabled: true
1740
+ VersionAdded: 0.50
1741
+
1742
+ Naming/ClassAndModuleCamelCase:
1743
+ Description: 'Use CamelCase for classes and modules.'
1744
+ StyleGuide: '#camelcase-classes'
1745
+ Enabled: true
1746
+ VersionAdded: 0.50
1747
+
1748
+ Naming/ConstantName:
1749
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
1750
+ StyleGuide: '#screaming-snake-case'
1751
+ Enabled: true
1752
+ VersionAdded: 0.50
1753
+
1754
+ Naming/FileName:
1755
+ Description: 'Use snake_case for source file names.'
1756
+ StyleGuide: '#snake-case-files'
1757
+ Enabled: true
1758
+ VersionAdded: 0.50
1759
+ # Camel case file names listed in `AllCops:Include` and all file names listed
1760
+ # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
1761
+ Exclude: []
1762
+ # When `true`, requires that each source file should define a class or module
1763
+ # with a name which matches the file name (converted to ... case).
1764
+ # It further expects it to be nested inside modules which match the names
1765
+ # of subdirectories in its path.
1766
+ ExpectMatchingDefinition: false
1767
+ # If non-`nil`, expect all source file names to match the following regex.
1768
+ # Only the file name itself is matched, not the entire file path.
1769
+ # Use anchors as necessary if you want to match the entire name rather than
1770
+ # just a part of it.
1771
+ Regex: ~
1772
+ # With `IgnoreExecutableScripts` set to `true`, this cop does not
1773
+ # report offending filenames for executable scripts (i.e. source
1774
+ # files with a shebang in the first line).
1775
+ IgnoreExecutableScripts: true
1776
+ AllowedAcronyms:
1777
+ - CLI
1778
+ - DSL
1779
+ - ACL
1780
+ - API
1781
+ - ASCII
1782
+ - CPU
1783
+ - CSS
1784
+ - DNS
1785
+ - EOF
1786
+ - GUID
1787
+ - HTML
1788
+ - HTTP
1789
+ - HTTPS
1790
+ - ID
1791
+ - IP
1792
+ - JSON
1793
+ - LHS
1794
+ - QPS
1795
+ - RAM
1796
+ - RHS
1797
+ - RPC
1798
+ - SLA
1799
+ - SMTP
1800
+ - SQL
1801
+ - SSH
1802
+ - TCP
1803
+ - TLS
1804
+ - TTL
1805
+ - UDP
1806
+ - UI
1807
+ - UID
1808
+ - UUID
1809
+ - URI
1810
+ - URL
1811
+ - UTF8
1812
+ - VM
1813
+ - XML
1814
+ - XMPP
1815
+ - XSRF
1816
+ - XSS
1817
+
1818
+ Naming/HeredocDelimiterCase:
1819
+ Description: 'Use configured case for heredoc delimiters.'
1820
+ StyleGuide: '#heredoc-delimiters'
1821
+ Enabled: true
1822
+ VersionAdded: 0.50
1823
+ EnforcedStyle: uppercase
1824
+ SupportedStyles:
1825
+ - lowercase
1826
+ - uppercase
1827
+
1828
+ Naming/HeredocDelimiterNaming:
1829
+ Description: 'Use descriptive heredoc delimiters.'
1830
+ StyleGuide: '#heredoc-delimiters'
1831
+ Enabled: true
1832
+ VersionAdded: 0.50
1833
+ Blacklist:
1834
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
1835
+
1836
+ Naming/MemoizedInstanceVariableName:
1837
+ Description: >-
1838
+ Memoized method name should match memo instance variable name.
1839
+ Enabled: true
1840
+ VersionAdded: 0.53
1841
+ VersionChanged: 0.58
1842
+ EnforcedStyleForLeadingUnderscores: disallowed
1843
+ SupportedStylesForLeadingUnderscores:
1844
+ - disallowed
1845
+ - required
1846
+ - optional
1847
+
1848
+ Naming/MethodName:
1849
+ Description: 'Use the configured style when naming methods.'
1850
+ StyleGuide: '#snake-case-symbols-methods-vars'
1851
+ Enabled: true
1852
+ VersionAdded: 0.50
1853
+ EnforcedStyle: snake_case
1854
+ SupportedStyles:
1855
+ - snake_case
1856
+ - camelCase
1857
+
1858
+ Naming/PredicateName:
1859
+ Description: 'Check the names of predicate methods.'
1860
+ StyleGuide: '#bool-methods-qmark'
1861
+ Enabled: true
1862
+ VersionAdded: 0.50
1863
+ VersionChanged: 0.51
1864
+ # Predicate name prefixes.
1865
+ NamePrefix:
1866
+ - is_
1867
+ - has_
1868
+ - have_
1869
+ # Predicate name prefixes that should be removed.
1870
+ NamePrefixBlacklist:
1871
+ - is_
1872
+ - has_
1873
+ - have_
1874
+ # Predicate names which, despite having a blacklisted prefix, or no `?`,
1875
+ # should still be accepted
1876
+ NameWhitelist:
1877
+ - is_a?
1878
+ # Method definition macros for dynamically generated methods.
1879
+ MethodDefinitionMacros:
1880
+ - define_method
1881
+ - define_singleton_method
1882
+ # Exclude Rspec specs because there is a strong convention to write spec
1883
+ # helpers in the form of `have_something` or `be_something`.
1884
+ Exclude:
1885
+ - 'spec/**/*'
1886
+
1887
+ Naming/UncommunicativeBlockParamName:
1888
+ Description: >-
1889
+ Checks for block parameter names that contain capital letters,
1890
+ end in numbers, or do not meet a minimal length.
1891
+ Enabled: true
1892
+ VersionAdded: 0.53
1893
+ # Parameter names may be equal to or greater than this value
1894
+ MinNameLength: 1
1895
+ AllowNamesEndingInNumbers: true
1896
+ # Whitelisted names that will not register an offense
1897
+ AllowedNames: []
1898
+ # Blacklisted names that will register an offense
1899
+ ForbiddenNames: []
1900
+
1901
+ Naming/UncommunicativeMethodParamName:
1902
+ Description: >-
1903
+ Checks for method parameter names that contain capital letters,
1904
+ end in numbers, or do not meet a minimal length.
1905
+ Enabled: true
1906
+ VersionAdded: 0.53
1907
+ VersionChanged: 0.59
788
1908
  # Parameter names may be equal to or greater than this value
789
1909
  MinNameLength: 3
790
1910
  AllowNamesEndingInNumbers: true
@@ -802,52 +1922,796 @@ Naming/UncommunicativeMethodParamName:
802
1922
  # Blacklisted names that will register an offense
803
1923
  ForbiddenNames: []
804
1924
 
1925
+
805
1926
  Naming/VariableName:
1927
+ Description: 'Use the configured style when naming variables.'
1928
+ StyleGuide: '#snake-case-symbols-methods-vars'
1929
+ Enabled: true
1930
+ VersionAdded: 0.50
806
1931
  EnforcedStyle: snake_case
807
1932
  SupportedStyles:
808
1933
  - snake_case
809
1934
  - camelCase
810
1935
 
811
1936
  Naming/VariableNumber:
1937
+ Description: 'Use the configured style when numbering variables.'
1938
+ Enabled: true
1939
+ VersionAdded: 0.50
812
1940
  EnforcedStyle: normalcase
813
1941
  SupportedStyles:
814
1942
  - snake_case
815
1943
  - normalcase
816
1944
  - non_integer
817
1945
 
818
- #################### Style ###########################
1946
+ #################### Performance ###########################
819
1947
 
820
- Style/AccessModifierDeclarations:
821
- EnforcedStyle: group
822
- SupportedStyles:
823
- - inline
824
- - group
1948
+ Performance/Caller:
1949
+ Description: >-
1950
+ Use `caller(n..n)` instead of `caller`.
1951
+ Enabled: true
1952
+ VersionAdded: 0.49
1953
+
1954
+ Performance/CaseWhenSplat:
1955
+ Description: >-
1956
+ Reordering `when` conditions with a splat to the end
1957
+ of the `when` branches can improve performance.
1958
+ Enabled: false
1959
+ AutoCorrect: false
1960
+ SafeAutoCorrect: false
1961
+ VersionAdded: 0.34
1962
+ VersionChanged: 0.59
1963
+
1964
+ Performance/Casecmp:
1965
+ Description: >-
1966
+ Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
1967
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
1968
+ Enabled: true
1969
+ VersionAdded: 0.36
1970
+
1971
+ Performance/ChainArrayAllocation:
1972
+ Description: >-
1973
+ Instead of chaining array methods that allocate new arrays, mutate an
1974
+ existing array.
1975
+ Reference: 'https://twitter.com/schneems/status/1034123879978029057'
1976
+ Enabled: false
1977
+ VersionAdded: 0.59
1978
+
1979
+ Performance/CompareWithBlock:
1980
+ Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
1981
+ Enabled: true
1982
+ VersionAdded: 0.46
1983
+
1984
+ Performance/Count:
1985
+ Description: >-
1986
+ Use `count` instead of `select...size`, `reject...size`,
1987
+ `select...count`, `reject...count`, `select...length`,
1988
+ and `reject...length`.
1989
+ # This cop has known compatibility issues with `ActiveRecord` and other
1990
+ # frameworks. ActiveRecord's `count` ignores the block that is passed to it.
1991
+ # For more information, see the documentation in the cop itself.
1992
+ # If you understand the known risk, you can disable `SafeMode`.
1993
+ SafeMode: true
1994
+ Enabled: true
1995
+ VersionAdded: 0.31
1996
+ VersionChanged: 0.39
1997
+
1998
+ Performance/Detect:
1999
+ Description: >-
2000
+ Use `detect` instead of `select.first`, `find_all.first`,
2001
+ `select.last`, and `find_all.last`.
2002
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
2003
+ # This cop has known compatibility issues with `ActiveRecord` and other
2004
+ # frameworks. `ActiveRecord` does not implement a `detect` method and `find`
2005
+ # has its own meaning. Correcting `ActiveRecord` methods with this cop
2006
+ # should be considered unsafe.
2007
+ SafeMode: true
2008
+ Enabled: true
2009
+ VersionAdded: 0.30
2010
+ VersionChanged: 0.39
825
2011
 
826
- Style/Alias:
827
- EnforcedStyle: prefer_alias
828
- SupportedStyles:
829
- - prefer_alias
830
- - prefer_alias_method
2012
+ Performance/DoubleStartEndWith:
2013
+ Description: >-
2014
+ Use `str.{start,end}_with?(x, ..., y, ...)`
2015
+ instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
2016
+ Enabled: true
2017
+ VersionAdded: 0.36
2018
+ VersionChanged: 0.48
2019
+ # Used to check for `starts_with?` and `ends_with?`.
2020
+ # These methods are defined by `ActiveSupport`.
2021
+ IncludeActiveSupportAliases: false
831
2022
 
832
- Style/AndOr:
833
- # Whether `and` and `or` are banned only in conditionals (conditionals)
834
- # or completely (always).
835
- EnforcedStyle: always
836
- SupportedStyles:
837
- - always
838
- - conditionals
2023
+ Performance/EndWith:
2024
+ Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
2025
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
2026
+ # This will change to a new method call which isn't guaranteed to be on the
2027
+ # object. Switching these methods has to be done with knowledge of the types
2028
+ # of the variables which rubocop doesn't have.
2029
+ SafeAutoCorrect: false
2030
+ AutoCorrect: false
2031
+ Enabled: true
2032
+ VersionAdded: 0.36
2033
+ VersionChanged: 0.44
2034
+
2035
+ Performance/FixedSize:
2036
+ Description: 'Do not compute the size of statically sized objects except in constants'
2037
+ Enabled: true
2038
+ VersionAdded: 0.35
2039
+
2040
+ Performance/FlatMap:
2041
+ Description: >-
2042
+ Use `Enumerable#flat_map`
2043
+ instead of `Enumerable#map...Array#flatten(1)`
2044
+ or `Enumberable#collect..Array#flatten(1)`
2045
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
2046
+ Enabled: true
2047
+ VersionAdded: 0.30
2048
+ EnabledForFlattenWithoutParams: false
2049
+ # If enabled, this cop will warn about usages of
2050
+ # `flatten` being called without any parameters.
2051
+ # This can be dangerous since `flat_map` will only flatten 1 level, and
2052
+ # `flatten` without any parameters can flatten multiple levels.
2053
+
2054
+ Performance/InefficientHashSearch:
2055
+ Description: 'Use `key?` or `value?` instead of `keys.include?` or `values.include?`'
2056
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code'
2057
+ Enabled: true
2058
+ VersionAdded: 0.56
2059
+ Safe: false
2060
+
2061
+ Performance/LstripRstrip:
2062
+ Description: 'Use `strip` instead of `lstrip.rstrip`.'
2063
+ Enabled: true
2064
+ VersionAdded: 0.36
2065
+
2066
+ Performance/RangeInclude:
2067
+ Description: 'Use `Range#cover?` instead of `Range#include?`.'
2068
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
2069
+ Enabled: true
2070
+ VersionAdded: 0.36
2071
+
2072
+ Performance/RedundantBlockCall:
2073
+ Description: 'Use `yield` instead of `block.call`.'
2074
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
2075
+ Enabled: true
2076
+ VersionAdded: 0.36
2077
+
2078
+ Performance/RedundantMatch:
2079
+ Description: >-
2080
+ Use `=~` instead of `String#match` or `Regexp#match` in a context where the
2081
+ returned `MatchData` is not needed.
2082
+ Enabled: true
2083
+ VersionAdded: 0.36
839
2084
 
840
- Style/AsciiComments:
841
- AllowedChars: []
2085
+ Performance/RedundantMerge:
2086
+ Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
2087
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
2088
+ Enabled: true
2089
+ VersionAdded: 0.36
2090
+ # Max number of key-value pairs to consider an offense
2091
+ MaxKeyValuePairs: 2
842
2092
 
843
- # Checks if usage of `%()` or `%Q()` matches configuration.
844
- Style/BarePercentLiterals:
845
- EnforcedStyle: bare_percent
846
- SupportedStyles:
847
- - percent_q
2093
+ Performance/RedundantSortBy:
2094
+ Description: 'Use `sort` instead of `sort_by { |x| x }`.'
2095
+ Enabled: true
2096
+ VersionAdded: 0.36
2097
+
2098
+ Performance/RegexpMatch:
2099
+ Description: >-
2100
+ Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
2101
+ `Regexp#===`, or `=~` when `MatchData` is not used.
2102
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
2103
+ Enabled: true
2104
+ VersionAdded: 0.47
2105
+
2106
+ Performance/ReverseEach:
2107
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
2108
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
2109
+ Enabled: true
2110
+ VersionAdded: 0.30
2111
+
2112
+ Performance/Sample:
2113
+ Description: >-
2114
+ Use `sample` instead of `shuffle.first`,
2115
+ `shuffle.last`, and `shuffle[Integer]`.
2116
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
2117
+ Enabled: true
2118
+ VersionAdded: 0.30
2119
+
2120
+ Performance/Size:
2121
+ Description: >-
2122
+ Use `size` instead of `count` for counting
2123
+ the number of elements in `Array` and `Hash`.
2124
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
2125
+ Enabled: true
2126
+ VersionAdded: 0.30
2127
+
2128
+ Performance/StartWith:
2129
+ Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
2130
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
2131
+ # This will change to a new method call which isn't guaranteed to be on the
2132
+ # object. Switching these methods has to be done with knowledge of the types
2133
+ # of the variables which rubocop doesn't have.
2134
+ SafeAutoCorrect: false
2135
+ AutoCorrect: false
2136
+ Enabled: true
2137
+ VersionAdded: 0.36
2138
+ VersionChanged: 0.44
2139
+
2140
+ Performance/StringReplacement:
2141
+ Description: >-
2142
+ Use `tr` instead of `gsub` when you are replacing the same
2143
+ number of characters. Use `delete` instead of `gsub` when
2144
+ you are deleting characters.
2145
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
2146
+ Enabled: true
2147
+ VersionAdded: 0.33
2148
+
2149
+ Performance/TimesMap:
2150
+ Description: 'Checks for .times.map calls.'
2151
+ AutoCorrect: false
2152
+ Enabled: true
2153
+ VersionAdded: 0.36
2154
+ VersionChanged: 0.50
2155
+ SafeAutoCorrect: false # see https://github.com/rubocop-hq/rubocop/issues/4658
2156
+
2157
+ Performance/UnfreezeString:
2158
+ Description: 'Use unary plus to get an unfrozen string literal.'
2159
+ Enabled: true
2160
+ VersionAdded: 0.50
2161
+
2162
+ Performance/UnneededSort:
2163
+ Description: >-
2164
+ Use `min` instead of `sort.first`,
2165
+ `max_by` instead of `sort_by...last`, etc.
2166
+ Enabled: true
2167
+ VersionAdded: 0.55
2168
+
2169
+ Performance/UriDefaultParser:
2170
+ Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
2171
+ Enabled: true
2172
+ VersionAdded: 0.50
2173
+
2174
+ #################### Rails #################################
2175
+
2176
+ # By default, the rails cops are not run. Override in project or home
2177
+ # directory .rubocop.yml files, or by giving the -R/--rails option.
2178
+ Rails:
2179
+ Enabled: false
2180
+
2181
+ Rails/ActionFilter:
2182
+ Description: 'Enforces consistent use of action filter methods.'
2183
+ Enabled: true
2184
+ VersionAdded: 0.19
2185
+ EnforcedStyle: action
2186
+ SupportedStyles:
2187
+ - action
2188
+ - filter
2189
+ Include:
2190
+ - app/controllers/**/*.rb
2191
+
2192
+ Rails/ActiveRecordAliases:
2193
+ Description: >-
2194
+ Avoid Active Record aliases:
2195
+ Use `update` instead of `update_attributes`.
2196
+ Use `update!` instead of `update_attributes!`.
2197
+ Enabled: true
2198
+ VersionAdded: 0.53
2199
+
2200
+ Rails/ActiveSupportAliases:
2201
+ Description: >-
2202
+ Avoid ActiveSupport aliases of standard ruby methods:
2203
+ `String#starts_with?`, `String#ends_with?`,
2204
+ `Array#append`, `Array#prepend`.
2205
+ Enabled: true
2206
+ VersionAdded: 0.48
2207
+
2208
+ Rails/ApplicationJob:
2209
+ Description: 'Check that jobs subclass ApplicationJob.'
2210
+ Enabled: true
2211
+ VersionAdded: 0.49
2212
+
2213
+ Rails/ApplicationRecord:
2214
+ Description: 'Check that models subclass ApplicationRecord.'
2215
+ Enabled: true
2216
+ VersionAdded: 0.49
2217
+
2218
+ Rails/AssertNot:
2219
+ Description: 'Use `assert_not` instead of `assert !`.'
2220
+ Enabled: true
2221
+ VersionAdded: 0.56
2222
+ Include:
2223
+ - '**/test/**/*'
2224
+
2225
+ Rails/Blank:
2226
+ Description: 'Enforces use of `blank?`.'
2227
+ Enabled: true
2228
+ VersionAdded: 0.48
2229
+ # Convert usages of `nil? || empty?` to `blank?`
2230
+ NilOrEmpty: true
2231
+ # Convert usages of `!present?` to `blank?`
2232
+ NotPresent: true
2233
+ # Convert usages of `unless present?` to `if blank?`
2234
+ UnlessPresent: true
2235
+
2236
+ Rails/BulkChangeTable:
2237
+ Description: 'Check whether alter queries are combinable.'
2238
+ Enabled: true
2239
+ VersionAdded: 0.57
2240
+ Database: null
2241
+ SupportedDatabases:
2242
+ - mysql
2243
+ - postgresql
2244
+ Include:
2245
+ - db/migrate/*.rb
2246
+
2247
+ Rails/CreateTableWithTimestamps:
2248
+ Description: >-
2249
+ Checks the migration for which timestamps are not included
2250
+ when creating a new table.
2251
+ Enabled: true
2252
+ VersionAdded: 0.52
2253
+ Include:
2254
+ - db/migrate/*.rb
2255
+
2256
+ Rails/Date:
2257
+ Description: >-
2258
+ Checks the correct usage of date aware methods,
2259
+ such as Date.today, Date.current etc.
2260
+ Enabled: true
2261
+ VersionAdded: 0.30
2262
+ VersionChanged: 0.33
2263
+ # The value `strict` disallows usage of `Date.today`, `Date.current`,
2264
+ # `Date#to_time` etc.
2265
+ # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
2266
+ # (but not `Date.today`) which are overridden by ActiveSupport to handle current
2267
+ # time zone.
2268
+ EnforcedStyle: flexible
2269
+ SupportedStyles:
2270
+ - strict
2271
+ - flexible
2272
+
2273
+ Rails/Delegate:
2274
+ Description: 'Prefer delegate method for delegations.'
2275
+ Enabled: true
2276
+ VersionAdded: 0.21
2277
+ VersionChanged: 0.50
2278
+ # When set to true, using the target object as a prefix of the
2279
+ # method name without using the `delegate` method will be a
2280
+ # violation. When set to false, this case is legal.
2281
+ EnforceForPrefixed: true
2282
+
2283
+ Rails/DelegateAllowBlank:
2284
+ Description: 'Do not use allow_blank as an option to delegate.'
2285
+ Enabled: true
2286
+ VersionAdded: 0.44
2287
+
2288
+ Rails/DynamicFindBy:
2289
+ Description: 'Use `find_by` instead of dynamic `find_by_*`.'
2290
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
2291
+ Enabled: true
2292
+ VersionAdded: 0.44
2293
+ Whitelist:
2294
+ - find_by_sql