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
@@ -1,161 +0,0 @@
1
- # These are all the cops that are disabled in the default configuration.
2
-
3
- Bundler/GemComment:
4
- Description: 'Add a comment describing each gem.'
5
- Enabled: false
6
- Include:
7
- - '**/*.gemfile'
8
- - '**/Gemfile'
9
- - '**/gems.rb'
10
- Whitelist: []
11
-
12
- Layout/ClassStructure:
13
- Description: 'Enforces a configured order of definitions within a class body.'
14
- StyleGuide: 'https://github.com/rubocop-hq/ruby-style-guide#consistent-classes'
15
- Enabled: false
16
-
17
- Layout/FirstArrayElementLineBreak:
18
- Description: >-
19
- Checks for a line break before the first element in a
20
- multi-line array.
21
- Enabled: false
22
-
23
- Layout/FirstHashElementLineBreak:
24
- Description: >-
25
- Checks for a line break before the first element in a
26
- multi-line hash.
27
- Enabled: false
28
-
29
- Layout/FirstMethodArgumentLineBreak:
30
- Description: >-
31
- Checks for a line break before the first argument in a
32
- multi-line method call.
33
- Enabled: false
34
-
35
- Layout/FirstMethodParameterLineBreak:
36
- Description: >-
37
- Checks for a line break before the first parameter in a
38
- multi-line method parameter definition.
39
- Enabled: false
40
-
41
- Layout/MultilineAssignmentLayout:
42
- Description: 'Check for a newline after the assignment operator in multi-line assignments.'
43
- StyleGuide: '#indent-conditional-assignment'
44
- Enabled: false
45
-
46
- Lint/NumberConversion:
47
- Description: 'Checks unsafe usage of number conversion methods.'
48
- Enabled: false
49
-
50
- Performance/CaseWhenSplat:
51
- Description: >-
52
- Reordering `when` conditions with a splat to the end
53
- of the `when` branches can improve performance.
54
- Enabled: false
55
- AutoCorrect: false
56
-
57
- Performance/ChainArrayAllocation:
58
- Description: >-
59
- Instead of chaining array methods that allocate new arrays, mutate an
60
- existing array.
61
- Reference: 'https://twitter.com/schneems/status/1034123879978029057'
62
- Enabled: false
63
-
64
- # By default, the rails cops are not run. Override in project or home
65
- # directory .rubocop.yml files, or by giving the -R/--rails option.
66
- Rails:
67
- Enabled: false
68
-
69
- Rails/SaveBang:
70
- Description: 'Identifies possible cases where Active Record save! or related should be used.'
71
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
72
- Enabled: false
73
-
74
- Style/AutoResourceCleanup:
75
- Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
76
- Enabled: false
77
-
78
- Style/CollectionMethods:
79
- Description: 'Preferred collection methods.'
80
- StyleGuide: '#map-find-select-reduce-size'
81
- Enabled: false
82
-
83
- Style/Copyright:
84
- Description: 'Include a copyright notice in each file before any code.'
85
- Enabled: false
86
-
87
- Style/DateTime:
88
- Description: 'Use Time over DateTime.'
89
- StyleGuide: '#date--time'
90
- Enabled: false
91
- AllowCoercion: false
92
-
93
- Style/DocumentationMethod:
94
- Description: 'Public methods.'
95
- Enabled: false
96
- Exclude:
97
- - 'spec/**/*'
98
- - 'test/**/*'
99
-
100
- Style/ImplicitRuntimeError:
101
- Description: >-
102
- Use `raise` or `fail` with an explicit exception class and
103
- message, rather than just a message.
104
- Enabled: false
105
-
106
- Style/InlineComment:
107
- Description: 'Avoid trailing inline comments.'
108
- Enabled: false
109
-
110
- Style/IpAddresses:
111
- Description: "Don't include literal IP addresses in code."
112
- Enabled: false
113
-
114
- Style/MethodCallWithArgsParentheses:
115
- Description: 'Use parentheses for method calls with arguments.'
116
- StyleGuide: '#method-invocation-parens'
117
- Enabled: false
118
-
119
- Style/MethodCalledOnDoEndBlock:
120
- Description: 'Avoid chaining a method call on a do...end block.'
121
- StyleGuide: '#single-line-blocks'
122
- Enabled: false
123
-
124
- Style/MissingElse:
125
- Description: >-
126
- Require if/case expressions to have an else branches.
127
- If enabled, it is recommended that
128
- Style/UnlessElse and Style/EmptyElse be enabled.
129
- This will conflict with Style/EmptyElse if
130
- Style/EmptyElse is configured to style "both"
131
- Enabled: false
132
-
133
- Style/MultilineMethodSignature:
134
- Description: 'Avoid multi-line method signatures.'
135
- Enabled: false
136
-
137
- Style/OptionHash:
138
- Description: "Don't use option hashes when you can use keyword arguments."
139
- Enabled: false
140
-
141
- Style/ReturnNil:
142
- Description: 'Use return instead of return nil.'
143
- Enabled: false
144
-
145
- Style/Send:
146
- Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
147
- StyleGuide: '#prefer-public-send'
148
- Enabled: false
149
-
150
- Style/SingleLineBlockParams:
151
- Description: 'Enforces the names of some block params.'
152
- Enabled: false
153
-
154
- Style/StringHashKeys:
155
- Description: 'Prefer symbols instead of strings as hash keys.'
156
- StyleGuide: '#symbols-as-keys'
157
- Enabled: false
158
-
159
- Style/StringMethods:
160
- Description: 'Checks if configured preferred methods are used over non-preferred.'
161
- Enabled: false
@@ -1,2092 +0,0 @@
1
- # These are all the cops that are enabled in the default configuration.
2
-
3
- #################### Bundler ###############################
4
-
5
- Bundler/DuplicatedGem:
6
- Description: 'Checks for duplicate gem entries in Gemfile.'
7
- Enabled: true
8
- Include:
9
- - '**/*.gemfile'
10
- - '**/Gemfile'
11
- - '**/gems.rb'
12
-
13
- Bundler/InsecureProtocolSource:
14
- Description: >-
15
- The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
16
- because HTTP requests are insecure. Please change your source to
17
- 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
18
- Enabled: true
19
- Include:
20
- - '**/*.gemfile'
21
- - '**/Gemfile'
22
- - '**/gems.rb'
23
-
24
- Bundler/OrderedGems:
25
- Description: >-
26
- Gems within groups in the Gemfile should be alphabetically sorted.
27
- Enabled: true
28
- Include:
29
- - '**/*.gemfile'
30
- - '**/Gemfile'
31
- - '**/gems.rb'
32
-
33
- #################### Gemspec ###############################
34
-
35
- Gemspec/DuplicatedAssignment:
36
- Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
37
- Enabled: true
38
- Include:
39
- - '**/*.gemspec'
40
-
41
- Gemspec/OrderedDependencies:
42
- Description: >-
43
- Dependencies in the gemspec should be alphabetically sorted.
44
- Enabled: true
45
- Include:
46
- - '**/*.gemspec'
47
-
48
- Gemspec/RequiredRubyVersion:
49
- Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
50
- Enabled: true
51
- Include:
52
- - '**/*.gemspec'
53
-
54
- #################### Layout ###############################
55
-
56
- Layout/AccessModifierIndentation:
57
- Description: Check indentation of private/protected visibility modifiers.
58
- StyleGuide: '#indent-public-private-protected'
59
- Enabled: true
60
-
61
- Layout/AlignArray:
62
- Description: >-
63
- Align the elements of an array literal if they span more than
64
- one line.
65
- StyleGuide: '#align-multiline-arrays'
66
- Enabled: true
67
-
68
- Layout/AlignHash:
69
- Description: >-
70
- Align the elements of a hash literal if they span more than
71
- one line.
72
- Enabled: true
73
-
74
- Layout/AlignParameters:
75
- Description: >-
76
- Align the parameters of a method call if they span more
77
- than one line.
78
- StyleGuide: '#no-double-indent'
79
- Enabled: true
80
-
81
- Layout/BlockAlignment:
82
- Description: 'Align block ends correctly.'
83
- Enabled: true
84
-
85
- Layout/BlockEndNewline:
86
- Description: 'Put end statement of multiline block on its own line.'
87
- Enabled: true
88
-
89
- Layout/CaseIndentation:
90
- Description: 'Indentation of when in a case/when/[else/]end.'
91
- StyleGuide: '#indent-when-to-case'
92
- Enabled: true
93
-
94
- Layout/ClosingHeredocIndentation:
95
- Description: 'Checks the indentation of here document closings.'
96
- Enabled: true
97
-
98
- Layout/ClosingParenthesisIndentation:
99
- Description: 'Checks the indentation of hanging closing parentheses.'
100
- Enabled: true
101
-
102
- Layout/CommentIndentation:
103
- Description: 'Indentation of comments.'
104
- Enabled: true
105
-
106
- Layout/ConditionPosition:
107
- Description: >-
108
- Checks for condition placed in a confusing position relative to
109
- the keyword.
110
- StyleGuide: '#same-line-condition'
111
- Enabled: true
112
-
113
- Layout/DefEndAlignment:
114
- Description: 'Align ends corresponding to defs correctly.'
115
- Enabled: true
116
-
117
- Layout/DotPosition:
118
- Description: 'Checks the position of the dot in multi-line method calls.'
119
- StyleGuide: '#consistent-multi-line-chains'
120
- Enabled: true
121
-
122
- Layout/ElseAlignment:
123
- Description: 'Align elses and elsifs correctly.'
124
- Enabled: true
125
-
126
- Layout/EmptyComment:
127
- Description: 'Checks empty comment.'
128
- Enabled: true
129
-
130
- Layout/EmptyLineAfterGuardClause:
131
- Description: 'Add empty line after guard clause.'
132
- Enabled: true
133
-
134
- Layout/EmptyLineAfterMagicComment:
135
- Description: 'Add an empty line after magic comments to separate them from code.'
136
- StyleGuide: '#separate-magic-comments-from-code'
137
- Enabled: true
138
-
139
- Layout/EmptyLineBetweenDefs:
140
- Description: 'Use empty lines between defs.'
141
- StyleGuide: '#empty-lines-between-methods'
142
- Enabled: true
143
-
144
- Layout/EmptyLines:
145
- Description: "Don't use several empty lines in a row."
146
- StyleGuide: '#two-or-more-empty-lines'
147
- Enabled: true
148
-
149
- Layout/EmptyLinesAroundAccessModifier:
150
- Description: "Keep blank lines around access modifiers."
151
- StyleGuide: '#empty-lines-around-access-modifier'
152
- Enabled: true
153
-
154
- Layout/EmptyLinesAroundArguments:
155
- Description: "Keeps track of empty lines around method arguments."
156
- Enabled: true
157
-
158
- Layout/EmptyLinesAroundBeginBody:
159
- Description: "Keeps track of empty lines around begin-end bodies."
160
- StyleGuide: '#empty-lines-around-bodies'
161
- Enabled: true
162
-
163
- Layout/EmptyLinesAroundBlockBody:
164
- Description: "Keeps track of empty lines around block bodies."
165
- StyleGuide: '#empty-lines-around-bodies'
166
- Enabled: true
167
-
168
- Layout/EmptyLinesAroundClassBody:
169
- Description: "Keeps track of empty lines around class bodies."
170
- StyleGuide: '#empty-lines-around-bodies'
171
- Enabled: true
172
-
173
- Layout/EmptyLinesAroundExceptionHandlingKeywords:
174
- Description: "Keeps track of empty lines around exception handling keywords."
175
- StyleGuide: '#empty-lines-around-bodies'
176
- Enabled: true
177
-
178
- Layout/EmptyLinesAroundMethodBody:
179
- Description: "Keeps track of empty lines around method bodies."
180
- StyleGuide: '#empty-lines-around-bodies'
181
- Enabled: true
182
-
183
- Layout/EmptyLinesAroundModuleBody:
184
- Description: "Keeps track of empty lines around module bodies."
185
- StyleGuide: '#empty-lines-around-bodies'
186
- Enabled: true
187
-
188
- Layout/EndAlignment:
189
- Description: 'Align ends correctly.'
190
- Enabled: true
191
-
192
- Layout/EndOfLine:
193
- Description: 'Use Unix-style line endings.'
194
- StyleGuide: '#crlf'
195
- Enabled: true
196
-
197
- Layout/ExtraSpacing:
198
- Description: 'Do not use unnecessary spacing.'
199
- Enabled: true
200
-
201
- Layout/FirstParameterIndentation:
202
- Description: 'Checks the indentation of the first parameter in a method call.'
203
- Enabled: true
204
-
205
- Layout/IndentArray:
206
- Description: >-
207
- Checks the indentation of the first element in an array
208
- literal.
209
- Enabled: true
210
-
211
- Layout/IndentAssignment:
212
- Description: >-
213
- Checks the indentation of the first line of the
214
- right-hand-side of a multi-line assignment.
215
- Enabled: true
216
-
217
- Layout/IndentHash:
218
- Description: 'Checks the indentation of the first key in a hash literal.'
219
- Enabled: true
220
-
221
- Layout/IndentHeredoc:
222
- Description: 'This cops checks the indentation of the here document bodies.'
223
- StyleGuide: '#squiggly-heredocs'
224
- Enabled: true
225
-
226
- Layout/IndentationConsistency:
227
- Description: 'Keep indentation straight.'
228
- StyleGuide: '#spaces-indentation'
229
- Enabled: true
230
-
231
- Layout/IndentationWidth:
232
- Description: 'Use 2 spaces for indentation.'
233
- StyleGuide: '#spaces-indentation'
234
- Enabled: true
235
-
236
- Layout/InitialIndentation:
237
- Description: >-
238
- Checks the indentation of the first non-blank non-comment line in a file.
239
- Enabled: true
240
-
241
- Layout/LeadingBlankLines:
242
- Description: Check for unnecessary blank lines at the beginning of a file.
243
- Enabled: true
244
-
245
- Layout/LeadingCommentSpace:
246
- Description: 'Comments should start with a space.'
247
- StyleGuide: '#hash-space'
248
- Enabled: true
249
-
250
- Layout/MultilineArrayBraceLayout:
251
- Description: >-
252
- Checks that the closing brace in an array literal is
253
- either on the same line as the last array element, or
254
- a new line.
255
- Enabled: true
256
-
257
- Layout/MultilineBlockLayout:
258
- Description: 'Ensures newlines after multiline block do statements.'
259
- Enabled: true
260
-
261
- Layout/MultilineHashBraceLayout:
262
- Description: >-
263
- Checks that the closing brace in a hash literal is
264
- either on the same line as the last hash element, or
265
- a new line.
266
- Enabled: true
267
-
268
- Layout/MultilineMethodCallBraceLayout:
269
- Description: >-
270
- Checks that the closing brace in a method call is
271
- either on the same line as the last method argument, or
272
- a new line.
273
- Enabled: true
274
-
275
- Layout/MultilineMethodCallIndentation:
276
- Description: >-
277
- Checks indentation of method calls with the dot operator
278
- that span more than one line.
279
- Enabled: true
280
-
281
- Layout/MultilineMethodDefinitionBraceLayout:
282
- Description: >-
283
- Checks that the closing brace in a method definition is
284
- either on the same line as the last method parameter, or
285
- a new line.
286
- Enabled: true
287
-
288
- Layout/MultilineOperationIndentation:
289
- Description: >-
290
- Checks indentation of binary operations that span more than
291
- one line.
292
- Enabled: true
293
-
294
- Layout/RescueEnsureAlignment:
295
- Description: 'Align rescues and ensures correctly.'
296
- Enabled: true
297
-
298
- Layout/SpaceAfterColon:
299
- Description: 'Use spaces after colons.'
300
- StyleGuide: '#spaces-operators'
301
- Enabled: true
302
-
303
- Layout/SpaceAfterComma:
304
- Description: 'Use spaces after commas.'
305
- StyleGuide: '#spaces-operators'
306
- Enabled: true
307
-
308
- Layout/SpaceAfterMethodName:
309
- Description: >-
310
- Do not put a space between a method name and the opening
311
- parenthesis in a method definition.
312
- StyleGuide: '#parens-no-spaces'
313
- Enabled: true
314
-
315
- Layout/SpaceAfterNot:
316
- Description: Tracks redundant space after the ! operator.
317
- StyleGuide: '#no-space-bang'
318
- Enabled: true
319
-
320
- Layout/SpaceAfterSemicolon:
321
- Description: 'Use spaces after semicolons.'
322
- StyleGuide: '#spaces-operators'
323
- Enabled: true
324
-
325
- Layout/SpaceAroundBlockParameters:
326
- Description: 'Checks the spacing inside and after block parameters pipes.'
327
- Enabled: true
328
-
329
- Layout/SpaceAroundEqualsInParameterDefault:
330
- Description: >-
331
- Checks that the equals signs in parameter default assignments
332
- have or don't have surrounding space depending on
333
- configuration.
334
- StyleGuide: '#spaces-around-equals'
335
- Enabled: true
336
-
337
- Layout/SpaceAroundKeyword:
338
- Description: 'Use a space around keywords if appropriate.'
339
- Enabled: true
340
-
341
- Layout/SpaceAroundOperators:
342
- Description: 'Use a single space around operators.'
343
- StyleGuide: '#spaces-operators'
344
- Enabled: true
345
-
346
- Layout/SpaceBeforeBlockBraces:
347
- Description: >-
348
- Checks that the left block brace has or doesn't have space
349
- before it.
350
- Enabled: true
351
-
352
- Layout/SpaceBeforeComma:
353
- Description: 'No spaces before commas.'
354
- Enabled: true
355
-
356
- Layout/SpaceBeforeComment:
357
- Description: >-
358
- Checks for missing space between code and a comment on the
359
- same line.
360
- Enabled: true
361
-
362
- Layout/SpaceBeforeFirstArg:
363
- Description: >-
364
- Checks that exactly one space is used between a method name
365
- and the first argument for method calls without parentheses.
366
- Enabled: true
367
-
368
- Layout/SpaceBeforeSemicolon:
369
- Description: 'No spaces before semicolons.'
370
- Enabled: true
371
-
372
- Layout/SpaceInLambdaLiteral:
373
- Description: 'Checks for spaces in lambda literals.'
374
- Enabled: true
375
-
376
- Layout/SpaceInsideArrayLiteralBrackets:
377
- Description: 'Checks the spacing inside array literal brackets.'
378
- Enabled: true
379
-
380
- Layout/SpaceInsideArrayPercentLiteral:
381
- Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
382
- Enabled: true
383
-
384
- Layout/SpaceInsideBlockBraces:
385
- Description: >-
386
- Checks that block braces have or don't have surrounding space.
387
- For blocks taking parameters, checks that the left brace has
388
- or doesn't have trailing space.
389
- Enabled: true
390
-
391
- Layout/SpaceInsideHashLiteralBraces:
392
- Description: "Use spaces inside hash literal braces - or don't."
393
- StyleGuide: '#spaces-operators'
394
- Enabled: true
395
-
396
- Layout/SpaceInsideParens:
397
- Description: 'No spaces after ( or before ).'
398
- StyleGuide: '#spaces-braces'
399
- Enabled: true
400
-
401
- Layout/SpaceInsidePercentLiteralDelimiters:
402
- Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
403
- Enabled: true
404
-
405
- Layout/SpaceInsideRangeLiteral:
406
- Description: 'No spaces inside range literals.'
407
- StyleGuide: '#no-space-inside-range-literals'
408
- Enabled: true
409
-
410
- Layout/SpaceInsideReferenceBrackets:
411
- Description: 'Checks the spacing inside referential brackets.'
412
- Enabled: true
413
-
414
- Layout/SpaceInsideStringInterpolation:
415
- Description: 'Checks for padding/surrounding spaces inside string interpolation.'
416
- StyleGuide: '#string-interpolation'
417
- Enabled: true
418
-
419
- Layout/Tab:
420
- Description: 'No hard tabs.'
421
- StyleGuide: '#spaces-indentation'
422
- Enabled: true
423
-
424
- Layout/TrailingBlankLines:
425
- Description: 'Checks trailing blank lines and final newline.'
426
- StyleGuide: '#newline-eof'
427
- Enabled: true
428
-
429
- Layout/TrailingWhitespace:
430
- Description: 'Avoid trailing whitespace.'
431
- StyleGuide: '#no-trailing-whitespace'
432
- Enabled: true
433
-
434
- #################### Lint ##################################
435
- ### Warnings
436
-
437
- Lint/AmbiguousBlockAssociation:
438
- Description: >-
439
- Checks for ambiguous block association with method when param passed without
440
- parentheses.
441
- StyleGuide: '#syntax'
442
- Enabled: true
443
-
444
- Lint/AmbiguousOperator:
445
- Description: >-
446
- Checks for ambiguous operators in the first argument of a
447
- method invocation without parentheses.
448
- StyleGuide: '#method-invocation-parens'
449
- Enabled: true
450
-
451
- Lint/AmbiguousRegexpLiteral:
452
- Description: >-
453
- Checks for ambiguous regexp literals in the first argument of
454
- a method invocation without parentheses.
455
- Enabled: true
456
-
457
- Lint/AssignmentInCondition:
458
- Description: "Don't use assignment in conditions."
459
- StyleGuide: '#safe-assignment-in-condition'
460
- Enabled: true
461
-
462
- Lint/BigDecimalNew:
463
- Description: '`BigDecimal.new()` is deprecated. Use `BigDecimal()` instead.'
464
- Enabled: true
465
-
466
- Lint/BooleanSymbol:
467
- Description: 'Check for `:true` and `:false` symbols.'
468
- Enabled: true
469
-
470
- Lint/CircularArgumentReference:
471
- Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
472
- Enabled: true
473
-
474
- Lint/Debugger:
475
- Description: 'Check for debugger calls.'
476
- Enabled: true
477
-
478
- Lint/DeprecatedClassMethods:
479
- Description: 'Check for deprecated class method calls.'
480
- Enabled: true
481
-
482
- Lint/DuplicateCaseCondition:
483
- Description: 'Do not repeat values in case conditionals.'
484
- Enabled: true
485
-
486
- Lint/DuplicateMethods:
487
- Description: 'Check for duplicate method definitions.'
488
- Enabled: true
489
-
490
- Lint/DuplicatedKey:
491
- Description: 'Check for duplicate keys in hash literals.'
492
- Enabled: true
493
-
494
- Lint/EachWithObjectArgument:
495
- Description: 'Check for immutable argument given to each_with_object.'
496
- Enabled: true
497
-
498
- Lint/ElseLayout:
499
- Description: 'Check for odd code arrangement in an else block.'
500
- Enabled: true
501
-
502
- Lint/EmptyEnsure:
503
- Description: 'Checks for empty ensure block.'
504
- Enabled: true
505
- AutoCorrect: false
506
-
507
- Lint/EmptyExpression:
508
- Description: 'Checks for empty expressions.'
509
- Enabled: true
510
-
511
- Lint/EmptyInterpolation:
512
- Description: 'Checks for empty string interpolation.'
513
- Enabled: true
514
-
515
- Lint/EmptyWhen:
516
- Description: 'Checks for `when` branches with empty bodies.'
517
- Enabled: true
518
-
519
- Lint/EndInMethod:
520
- Description: 'END blocks should not be placed inside method definitions.'
521
- Enabled: true
522
-
523
- Lint/EnsureReturn:
524
- Description: 'Do not use return in an ensure block.'
525
- StyleGuide: '#no-return-ensure'
526
- Enabled: true
527
-
528
- Lint/ErbNewArguments:
529
- Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
530
- Enabled: true
531
-
532
- Lint/FloatOutOfRange:
533
- Description: >-
534
- Catches floating-point literals too large or small for Ruby to
535
- represent.
536
- Enabled: true
537
-
538
- Lint/FormatParameterMismatch:
539
- Description: 'The number of parameters to format/sprint must match the fields.'
540
- Enabled: true
541
-
542
- Lint/HandleExceptions:
543
- Description: "Don't suppress exception."
544
- StyleGuide: '#dont-hide-exceptions'
545
- Enabled: true
546
-
547
- Lint/ImplicitStringConcatenation:
548
- Description: >-
549
- Checks for adjacent string literals on the same line, which
550
- could better be represented as a single string literal.
551
- Enabled: true
552
-
553
- Lint/IneffectiveAccessModifier:
554
- Description: >-
555
- Checks for attempts to use `private` or `protected` to set
556
- the visibility of a class method, which does not work.
557
- Enabled: true
558
-
559
- Lint/InheritException:
560
- Description: 'Avoid inheriting from the `Exception` class.'
561
- Enabled: true
562
-
563
- Lint/InterpolationCheck:
564
- Description: 'Raise warning for interpolation in single q strs'
565
- Enabled: true
566
-
567
- Lint/LiteralAsCondition:
568
- Description: 'Checks of literals used in conditions.'
569
- Enabled: true
570
-
571
- Lint/LiteralInInterpolation:
572
- Description: 'Checks for literals used in interpolation.'
573
- Enabled: true
574
-
575
- Lint/Loop:
576
- Description: >-
577
- Use Kernel#loop with break rather than begin/end/until or
578
- begin/end/while for post-loop tests.
579
- StyleGuide: '#loop-with-break'
580
- Enabled: true
581
-
582
- Lint/MissingCopEnableDirective:
583
- Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
584
- Enabled: true
585
-
586
- Lint/MultipleCompare:
587
- Description: "Use `&&` operator to compare multiple value."
588
- Enabled: true
589
-
590
- Lint/NestedMethodDefinition:
591
- Description: 'Do not use nested method definitions.'
592
- StyleGuide: '#no-nested-methods'
593
- Enabled: true
594
-
595
- Lint/NestedPercentLiteral:
596
- Description: 'Checks for nested percent literals.'
597
- Enabled: true
598
-
599
- Lint/NextWithoutAccumulator:
600
- Description: >-
601
- Do not omit the accumulator when calling `next`
602
- in a `reduce`/`inject` block.
603
- Enabled: true
604
-
605
- Lint/NonLocalExitFromIterator:
606
- Description: 'Do not use return in iterator to cause non-local exit.'
607
- Enabled: true
608
-
609
- Lint/OrderedMagicComments:
610
- Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
611
- Enabled: true
612
-
613
- Lint/ParenthesesAsGroupedExpression:
614
- Description: >-
615
- Checks for method calls with a space before the opening
616
- parenthesis.
617
- StyleGuide: '#parens-no-spaces'
618
- Enabled: true
619
-
620
- Lint/PercentStringArray:
621
- Description: >-
622
- Checks for unwanted commas and quotes in %w/%W literals.
623
- Enabled: true
624
-
625
- Lint/PercentSymbolArray:
626
- Description: >-
627
- Checks for unwanted commas and colons in %i/%I literals.
628
- Enabled: true
629
-
630
- Lint/RandOne:
631
- Description: >-
632
- Checks for `rand(1)` calls. Such calls always return `0`
633
- and most likely a mistake.
634
- Enabled: true
635
-
636
- Lint/RedundantWithIndex:
637
- Description: 'Checks for redundant `with_index`.'
638
- Enabled: true
639
-
640
- Lint/RedundantWithObject:
641
- Description: 'Checks for redundant `with_object`.'
642
- Enabled: true
643
-
644
- Lint/RegexpAsCondition:
645
- Description: >-
646
- Do not use regexp literal as a condition.
647
- The regexp literal matches `$_` implicitly.
648
- Enabled: true
649
-
650
- Lint/RequireParentheses:
651
- Description: >-
652
- Use parentheses in the method call to avoid confusion
653
- about precedence.
654
- Enabled: true
655
-
656
- Lint/RescueException:
657
- Description: 'Avoid rescuing the Exception class.'
658
- StyleGuide: '#no-blind-rescues'
659
- Enabled: true
660
-
661
- Lint/RescueType:
662
- Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
663
- Enabled: true
664
-
665
- Lint/ReturnInVoidContext:
666
- Description: 'Checks for return in void context.'
667
- Enabled: true
668
-
669
- Lint/SafeNavigationChain:
670
- Description: 'Do not chain ordinary method call after safe navigation operator.'
671
- Enabled: true
672
-
673
- Lint/SafeNavigationConsistency:
674
- Description: >-
675
- Check to make sure that if safe navigation is used for a method
676
- call in an `&&` or `||` condition that safe navigation is used
677
- for all method calls on that same object.
678
- Enabled: true
679
-
680
- Lint/ScriptPermission:
681
- Description: 'Grant script file execute permission.'
682
- Enabled: true
683
-
684
- Lint/ShadowedArgument:
685
- Description: 'Avoid reassigning arguments before they were used.'
686
- Enabled: true
687
-
688
- Lint/ShadowedException:
689
- Description: >-
690
- Avoid rescuing a higher level exception
691
- before a lower level exception.
692
- Enabled: true
693
-
694
- Lint/ShadowingOuterLocalVariable:
695
- Description: >-
696
- Do not use the same name as outer local variable
697
- for block arguments or block local variables.
698
- Enabled: true
699
-
700
- Lint/StringConversionInInterpolation:
701
- Description: 'Checks for Object#to_s usage in string interpolation.'
702
- StyleGuide: '#no-to-s'
703
- Enabled: true
704
-
705
- Lint/Syntax:
706
- Description: 'Checks syntax error'
707
- Enabled: true
708
-
709
- Lint/UnderscorePrefixedVariableName:
710
- Description: 'Do not use prefix `_` for a variable that is used.'
711
- Enabled: true
712
-
713
- Lint/UnifiedInteger:
714
- Description: 'Use Integer instead of Fixnum or Bignum'
715
- Enabled: true
716
-
717
- Lint/UnneededCopDisableDirective:
718
- Description: >-
719
- Checks for rubocop:disable comments that can be removed.
720
- Note: this cop is not disabled when disabling all cops.
721
- It must be explicitly disabled.
722
- Enabled: true
723
-
724
- Lint/UnneededCopEnableDirective:
725
- Description: Checks for rubocop:enable comments that can be removed.
726
-
727
- Enabled: true
728
-
729
- Lint/UnneededRequireStatement:
730
- Description: 'Checks for unnecessary `require` statement.'
731
- Enabled: true
732
-
733
- Lint/UnneededSplatExpansion:
734
- Description: 'Checks for splat unnecessarily being called on literals'
735
- Enabled: true
736
-
737
- Lint/UnreachableCode:
738
- Description: 'Unreachable code.'
739
- Enabled: true
740
-
741
- Lint/UnusedBlockArgument:
742
- Description: 'Checks for unused block arguments.'
743
- StyleGuide: '#underscore-unused-vars'
744
- Enabled: true
745
-
746
- Lint/UnusedMethodArgument:
747
- Description: 'Checks for unused method arguments.'
748
- StyleGuide: '#underscore-unused-vars'
749
- Enabled: true
750
-
751
- Lint/UriEscapeUnescape:
752
- Description: >-
753
- `URI.escape` method is obsolete and should not be used. Instead, use
754
- `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
755
- depending on your specific use case.
756
- Also `URI.unescape` method is obsolete and should not be used. Instead, use
757
- `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
758
- depending on your specific use case.
759
- Enabled: true
760
-
761
- Lint/UriRegexp:
762
- Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
763
- Enabled: true
764
-
765
- Lint/UselessAccessModifier:
766
- Description: 'Checks for useless access modifiers.'
767
- Enabled: true
768
-
769
- Lint/UselessAssignment:
770
- Description: 'Checks for useless assignment to a local variable.'
771
- StyleGuide: '#underscore-unused-vars'
772
- Enabled: true
773
-
774
- Lint/UselessComparison:
775
- Description: 'Checks for comparison of something with itself.'
776
- Enabled: true
777
-
778
- Lint/UselessElseWithoutRescue:
779
- Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
780
- Enabled: true
781
-
782
- Lint/UselessSetterCall:
783
- Description: 'Checks for useless setter call to a local variable.'
784
- Enabled: true
785
-
786
- Lint/Void:
787
- Description: 'Possible use of operator/literal/variable in void context.'
788
- Enabled: true
789
-
790
- #################### Metrics ###############################
791
-
792
- Metrics/AbcSize:
793
- Description: >-
794
- A calculated magnitude based on number of assignments,
795
- branches, and conditions.
796
- Reference: 'http://c2.com/cgi/wiki?AbcMetric'
797
- Enabled: true
798
-
799
- Metrics/BlockLength:
800
- Description: 'Avoid long blocks with many lines.'
801
- Enabled: true
802
-
803
- Metrics/BlockNesting:
804
- Description: 'Avoid excessive block nesting'
805
- StyleGuide: '#three-is-the-number-thou-shalt-count'
806
- Enabled: true
807
-
808
- Metrics/ClassLength:
809
- Description: 'Avoid classes longer than 100 lines of code.'
810
- Enabled: true
811
-
812
- Metrics/CyclomaticComplexity:
813
- Description: >-
814
- A complexity metric that is strongly correlated to the number
815
- of test cases needed to validate a method.
816
- Enabled: true
817
-
818
- Metrics/LineLength:
819
- Description: 'Limit lines to 80 characters.'
820
- StyleGuide: '#80-character-limits'
821
- Enabled: true
822
-
823
- Metrics/MethodLength:
824
- Description: 'Avoid methods longer than 10 lines of code.'
825
- StyleGuide: '#short-methods'
826
- Enabled: true
827
-
828
- Metrics/ModuleLength:
829
- Description: 'Avoid modules longer than 100 lines of code.'
830
- Enabled: true
831
-
832
- Metrics/ParameterLists:
833
- Description: 'Avoid parameter lists longer than three or four parameters.'
834
- StyleGuide: '#too-many-params'
835
- Enabled: true
836
-
837
- Metrics/PerceivedComplexity:
838
- Description: >-
839
- A complexity metric geared towards measuring complexity for a
840
- human reader.
841
- Enabled: true
842
-
843
- #################### Naming ##############################
844
-
845
- Naming/AccessorMethodName:
846
- Description: Check the naming of accessor methods for get_/set_.
847
- StyleGuide: '#accessor_mutator_method_names'
848
- Enabled: true
849
-
850
- Naming/AsciiIdentifiers:
851
- Description: 'Use only ascii symbols in identifiers.'
852
- StyleGuide: '#english-identifiers'
853
- Enabled: true
854
-
855
- Naming/BinaryOperatorParameterName:
856
- Description: 'When defining binary operators, name the argument other.'
857
- StyleGuide: '#other-arg'
858
- Enabled: true
859
-
860
- Naming/ClassAndModuleCamelCase:
861
- Description: 'Use CamelCase for classes and modules.'
862
- StyleGuide: '#camelcase-classes'
863
- Enabled: true
864
-
865
- Naming/ConstantName:
866
- Description: 'Constants should use SCREAMING_SNAKE_CASE.'
867
- StyleGuide: '#screaming-snake-case'
868
- Enabled: true
869
-
870
- Naming/FileName:
871
- Description: 'Use snake_case for source file names.'
872
- StyleGuide: '#snake-case-files'
873
- Enabled: true
874
-
875
- Naming/HeredocDelimiterCase:
876
- Description: 'Use configured case for heredoc delimiters.'
877
- StyleGuide: '#heredoc-delimiters'
878
- Enabled: true
879
-
880
- Naming/HeredocDelimiterNaming:
881
- Description: 'Use descriptive heredoc delimiters.'
882
- StyleGuide: '#heredoc-delimiters'
883
- Enabled: true
884
-
885
- Naming/MemoizedInstanceVariableName:
886
- Description: >-
887
- Memoized method name should match memo instance variable name.
888
- Enabled: true
889
-
890
- Naming/MethodName:
891
- Description: 'Use the configured style when naming methods.'
892
- StyleGuide: '#snake-case-symbols-methods-vars'
893
- Enabled: true
894
-
895
- Naming/PredicateName:
896
- Description: 'Check the names of predicate methods.'
897
- StyleGuide: '#bool-methods-qmark'
898
- Enabled: true
899
-
900
- Naming/UncommunicativeBlockParamName:
901
- Description: >-
902
- Checks for block parameter names that contain capital letters,
903
- end in numbers, or do not meet a minimal length.
904
- Enabled: true
905
-
906
- Naming/UncommunicativeMethodParamName:
907
- Description: >-
908
- Checks for method parameter names that contain capital letters,
909
- end in numbers, or do not meet a minimal length.
910
- Enabled: true
911
-
912
- Naming/VariableName:
913
- Description: 'Use the configured style when naming variables.'
914
- StyleGuide: '#snake-case-symbols-methods-vars'
915
- Enabled: true
916
-
917
- Naming/VariableNumber:
918
- Description: 'Use the configured style when numbering variables.'
919
- Enabled: true
920
-
921
- #################### Performance ###########################
922
-
923
- Performance/Caller:
924
- Description: >-
925
- Use `caller(n..n)` instead of `caller`.
926
- Enabled: true
927
-
928
- Performance/Casecmp:
929
- Description: >-
930
- Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
931
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
932
- Enabled: true
933
-
934
- Performance/CompareWithBlock:
935
- Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
936
- Enabled: true
937
-
938
- Performance/Count:
939
- Description: >-
940
- Use `count` instead of `select...size`, `reject...size`,
941
- `select...count`, `reject...count`, `select...length`,
942
- and `reject...length`.
943
- # This cop has known compatibility issues with `ActiveRecord` and other
944
- # frameworks. ActiveRecord's `count` ignores the block that is passed to it.
945
- # For more information, see the documentation in the cop itself.
946
- # If you understand the known risk, you can disable `SafeMode`.
947
- SafeMode: true
948
- Enabled: true
949
-
950
- Performance/Detect:
951
- Description: >-
952
- Use `detect` instead of `select.first`, `find_all.first`,
953
- `select.last`, and `find_all.last`.
954
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
955
- # This cop has known compatibility issues with `ActiveRecord` and other
956
- # frameworks. `ActiveRecord` does not implement a `detect` method and `find`
957
- # has its own meaning. Correcting `ActiveRecord` methods with this cop
958
- # should be considered unsafe.
959
- SafeMode: true
960
- Enabled: true
961
-
962
- Performance/DoubleStartEndWith:
963
- Description: >-
964
- Use `str.{start,end}_with?(x, ..., y, ...)`
965
- instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
966
- Enabled: true
967
-
968
- Performance/EndWith:
969
- Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
970
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
971
- # This will change to a new method call which isn't guaranteed to be on the
972
- # object. Switching these methods has to be done with knowledge of the types
973
- # of the variables which rubocop doesn't have.
974
- AutoCorrect: false
975
- Enabled: true
976
-
977
- Performance/FixedSize:
978
- Description: 'Do not compute the size of statically sized objects except in constants'
979
- Enabled: true
980
-
981
- Performance/FlatMap:
982
- Description: >-
983
- Use `Enumerable#flat_map`
984
- instead of `Enumerable#map...Array#flatten(1)`
985
- or `Enumberable#collect..Array#flatten(1)`
986
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
987
- Enabled: true
988
- EnabledForFlattenWithoutParams: false
989
- # If enabled, this cop will warn about usages of
990
- # `flatten` being called without any parameters.
991
- # This can be dangerous since `flat_map` will only flatten 1 level, and
992
- # `flatten` without any parameters can flatten multiple levels.
993
-
994
- Performance/InefficientHashSearch:
995
- Description: 'Use `key?` or `value?` instead of `keys.include?` or `values.include?`'
996
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code'
997
- Enabled: true
998
-
999
- Performance/LstripRstrip:
1000
- Description: 'Use `strip` instead of `lstrip.rstrip`.'
1001
- Enabled: true
1002
-
1003
- Performance/RangeInclude:
1004
- Description: 'Use `Range#cover?` instead of `Range#include?`.'
1005
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
1006
- Enabled: true
1007
-
1008
- Performance/RedundantBlockCall:
1009
- Description: 'Use `yield` instead of `block.call`.'
1010
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
1011
- Enabled: true
1012
-
1013
- Performance/RedundantMatch:
1014
- Description: >-
1015
- Use `=~` instead of `String#match` or `Regexp#match` in a context where the
1016
- returned `MatchData` is not needed.
1017
- Enabled: true
1018
-
1019
- Performance/RedundantMerge:
1020
- Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
1021
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
1022
- Enabled: true
1023
-
1024
- Performance/RedundantSortBy:
1025
- Description: 'Use `sort` instead of `sort_by { |x| x }`.'
1026
- Enabled: true
1027
-
1028
- Performance/RegexpMatch:
1029
- Description: >-
1030
- Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
1031
- `Regexp#===`, or `=~` when `MatchData` is not used.
1032
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
1033
- Enabled: true
1034
-
1035
- Performance/ReverseEach:
1036
- Description: 'Use `reverse_each` instead of `reverse.each`.'
1037
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
1038
- Enabled: true
1039
-
1040
- Performance/Sample:
1041
- Description: >-
1042
- Use `sample` instead of `shuffle.first`,
1043
- `shuffle.last`, and `shuffle[Integer]`.
1044
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
1045
- Enabled: true
1046
-
1047
- Performance/Size:
1048
- Description: >-
1049
- Use `size` instead of `count` for counting
1050
- the number of elements in `Array` and `Hash`.
1051
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
1052
- Enabled: true
1053
-
1054
- Performance/StartWith:
1055
- Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
1056
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
1057
- # This will change to a new method call which isn't guaranteed to be on the
1058
- # object. Switching these methods has to be done with knowledge of the types
1059
- # of the variables which rubocop doesn't have.
1060
- AutoCorrect: false
1061
- Enabled: true
1062
-
1063
- Performance/StringReplacement:
1064
- Description: >-
1065
- Use `tr` instead of `gsub` when you are replacing the same
1066
- number of characters. Use `delete` instead of `gsub` when
1067
- you are deleting characters.
1068
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
1069
- Enabled: true
1070
-
1071
- Performance/TimesMap:
1072
- Description: 'Checks for .times.map calls.'
1073
- AutoCorrect: false
1074
- Enabled: true
1075
-
1076
- Performance/UnfreezeString:
1077
- Description: 'Use unary plus to get an unfrozen string literal.'
1078
- Enabled: true
1079
-
1080
- Performance/UnneededSort:
1081
- Description: >-
1082
- Use `min` instead of `sort.first`,
1083
- `max_by` instead of `sort_by...last`, etc.
1084
- Enabled: true
1085
-
1086
- Performance/UriDefaultParser:
1087
- Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
1088
- Enabled: true
1089
-
1090
- #################### Rails #################################
1091
-
1092
- Rails/ActionFilter:
1093
- Description: 'Enforces consistent use of action filter methods.'
1094
- Enabled: true
1095
-
1096
- Rails/ActiveRecordAliases:
1097
- Description: >-
1098
- Avoid Active Record aliases:
1099
- Use `update` instead of `update_attributes`.
1100
- Use `update!` instead of `update_attributes!`.
1101
- Enabled: true
1102
-
1103
- Rails/ActiveSupportAliases:
1104
- Description: >-
1105
- Avoid ActiveSupport aliases of standard ruby methods:
1106
- `String#starts_with?`, `String#ends_with?`,
1107
- `Array#append`, `Array#prepend`.
1108
- Enabled: true
1109
-
1110
- Rails/ApplicationJob:
1111
- Description: 'Check that jobs subclass ApplicationJob.'
1112
- Enabled: true
1113
-
1114
- Rails/ApplicationRecord:
1115
- Description: 'Check that models subclass ApplicationRecord.'
1116
- Enabled: true
1117
-
1118
- Rails/AssertNot:
1119
- Description: 'Use `assert_not` instead of `assert !`.'
1120
- Enabled: true
1121
-
1122
- Rails/Blank:
1123
- Description: 'Enforces use of `blank?`.'
1124
- Enabled: true
1125
-
1126
- Rails/BulkChangeTable:
1127
- Description: 'Check whether alter queries are combinable.'
1128
- Enabled: true
1129
-
1130
- Rails/CreateTableWithTimestamps:
1131
- Description: >-
1132
- Checks the migration for which timestamps are not included
1133
- when creating a new table.
1134
- Enabled: true
1135
-
1136
- Rails/Date:
1137
- Description: >-
1138
- Checks the correct usage of date aware methods,
1139
- such as Date.today, Date.current etc.
1140
- Enabled: true
1141
-
1142
- Rails/Delegate:
1143
- Description: 'Prefer delegate method for delegations.'
1144
- Enabled: true
1145
-
1146
- Rails/DelegateAllowBlank:
1147
- Description: 'Do not use allow_blank as an option to delegate.'
1148
- Enabled: true
1149
-
1150
- Rails/DynamicFindBy:
1151
- Description: 'Use `find_by` instead of dynamic `find_by_*`.'
1152
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
1153
- Enabled: true
1154
-
1155
- Rails/EnumUniqueness:
1156
- Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
1157
- Enabled: true
1158
-
1159
- Rails/EnvironmentComparison:
1160
- Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
1161
- Enabled: true
1162
-
1163
- Rails/Exit:
1164
- Description: >-
1165
- Favor `fail`, `break`, `return`, etc. over `exit` in
1166
- application or library code outside of Rake files to avoid
1167
- exits during unit testing or running in production.
1168
- Enabled: true
1169
-
1170
- Rails/FilePath:
1171
- Description: 'Use `Rails.root.join` for file path joining.'
1172
- Enabled: true
1173
-
1174
- Rails/FindBy:
1175
- Description: 'Prefer find_by over where.first.'
1176
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
1177
- Enabled: true
1178
-
1179
- Rails/FindEach:
1180
- Description: 'Prefer all.find_each over all.find.'
1181
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
1182
- Enabled: true
1183
-
1184
- Rails/HasAndBelongsToMany:
1185
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
1186
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
1187
- Enabled: true
1188
-
1189
- Rails/HasManyOrHasOneDependent:
1190
- Description: 'Define the dependent option to the has_many and has_one associations.'
1191
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
1192
- Enabled: true
1193
-
1194
- Rails/HttpPositionalArguments:
1195
- Description: 'Use keyword arguments instead of positional arguments in http method calls.'
1196
- Enabled: true
1197
- Include:
1198
- - 'spec/**/*'
1199
- - 'test/**/*'
1200
-
1201
- Rails/HttpStatus:
1202
- Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
1203
- Enabled: true
1204
-
1205
- Rails/InverseOf:
1206
- Description: 'Checks for associations where the inverse cannot be determined automatically.'
1207
- Enabled: true
1208
-
1209
- Rails/LexicallyScopedActionFilter:
1210
- Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
1211
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
1212
- Enabled: true
1213
-
1214
- Rails/NotNullColumn:
1215
- Description: 'Do not add a NOT NULL column without a default value'
1216
- Enabled: true
1217
-
1218
- Rails/Output:
1219
- Description: 'Checks for calls to puts, print, etc.'
1220
- Enabled: true
1221
-
1222
- Rails/OutputSafety:
1223
- Description: 'The use of `html_safe` or `raw` may be a security risk.'
1224
- Enabled: true
1225
-
1226
- Rails/PluralizationGrammar:
1227
- Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
1228
- Enabled: true
1229
-
1230
- Rails/Presence:
1231
- Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
1232
- Enabled: true
1233
-
1234
- Rails/Present:
1235
- Description: 'Enforces use of `present?`.'
1236
- Enabled: true
1237
-
1238
- Rails/ReadWriteAttribute:
1239
- Description: >-
1240
- Checks for read_attribute(:attr) and
1241
- write_attribute(:attr, val).
1242
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
1243
- Enabled: true
1244
-
1245
- Rails/RedundantReceiverInWithOptions:
1246
- Description: 'Checks for redundant receiver in `with_options`.'
1247
- Enabled: true
1248
-
1249
- Rails/RefuteMethods:
1250
- Description: 'Use `assert_not` methods instead of `refute` methods.'
1251
- Enabled: true
1252
-
1253
- Rails/RelativeDateConstant:
1254
- Description: 'Do not assign relative date to constants.'
1255
- Enabled: true
1256
-
1257
- Rails/RequestReferer:
1258
- Description: 'Use consistent syntax for request.referer.'
1259
- Enabled: true
1260
-
1261
- Rails/ReversibleMigration:
1262
- Description: 'Checks whether the change method of the migration file is reversible.'
1263
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
1264
- Reference: 'http://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
1265
- Enabled: true
1266
-
1267
- Rails/SafeNavigation:
1268
- Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
1269
- Enabled: true
1270
-
1271
- Rails/ScopeArgs:
1272
- Description: 'Checks the arguments of ActiveRecord scopes.'
1273
- Enabled: true
1274
-
1275
- Rails/SkipsModelValidations:
1276
- Description: >-
1277
- Use methods that skips model validations with caution.
1278
- See reference for more information.
1279
- Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
1280
- Enabled: true
1281
-
1282
- Rails/TimeZone:
1283
- Description: 'Checks the correct usage of time zone aware methods.'
1284
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
1285
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
1286
- Enabled: true
1287
-
1288
- Rails/UniqBeforePluck:
1289
- Description: 'Prefer the use of uniq or distinct before pluck.'
1290
- Enabled: true
1291
-
1292
- Rails/UnknownEnv:
1293
- Description: 'Use correct environment name.'
1294
- Enabled: true
1295
-
1296
- Rails/Validation:
1297
- Description: 'Use validates :attribute, hash of validations.'
1298
- Enabled: true
1299
-
1300
- #################### Security ##############################
1301
-
1302
- Security/Eval:
1303
- Description: 'The use of eval represents a serious security risk.'
1304
- Enabled: true
1305
-
1306
- Security/JSONLoad:
1307
- Description: >-
1308
- Prefer usage of `JSON.parse` over `JSON.load` due to potential
1309
- security issues. See reference for more information.
1310
- Reference: 'http://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
1311
- Enabled: true
1312
- # Autocorrect here will change to a method that may cause crashes depending
1313
- # on the value of the argument.
1314
- AutoCorrect: false
1315
-
1316
- Security/MarshalLoad:
1317
- Description: >-
1318
- Avoid using of `Marshal.load` or `Marshal.restore` due to potential
1319
- security issues. See reference for more information.
1320
- Reference: 'http://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
1321
- Enabled: true
1322
-
1323
- Security/Open:
1324
- Description: 'The use of Kernel#open represents a serious security risk.'
1325
- Enabled: true
1326
-
1327
- Security/YAMLLoad:
1328
- Description: >-
1329
- Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
1330
- security issues. See reference for more information.
1331
- Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
1332
- Enabled: true
1333
-
1334
- #################### Style ###############################
1335
-
1336
- Style/AccessModifierDeclarations:
1337
- Description: 'Checks style of how access modifiers are used.'
1338
- Enabled: true
1339
-
1340
- Style/Alias:
1341
- Description: 'Use alias instead of alias_method.'
1342
- StyleGuide: '#alias-method'
1343
- Enabled: true
1344
-
1345
- Style/AndOr:
1346
- Description: 'Use &&/|| instead of and/or.'
1347
- StyleGuide: '#no-and-or-or'
1348
- Enabled: true
1349
-
1350
- Style/ArrayJoin:
1351
- Description: 'Use Array#join instead of Array#*.'
1352
- StyleGuide: '#array-join'
1353
- Enabled: true
1354
-
1355
- Style/AsciiComments:
1356
- Description: 'Use only ascii symbols in comments.'
1357
- StyleGuide: '#english-comments'
1358
- Enabled: true
1359
-
1360
- Style/Attr:
1361
- Description: 'Checks for uses of Module#attr.'
1362
- StyleGuide: '#attr'
1363
- Enabled: true
1364
-
1365
- Style/BarePercentLiterals:
1366
- Description: 'Checks if usage of %() or %Q() matches configuration.'
1367
- StyleGuide: '#percent-q-shorthand'
1368
- Enabled: true
1369
-
1370
- Style/BeginBlock:
1371
- Description: 'Avoid the use of BEGIN blocks.'
1372
- StyleGuide: '#no-BEGIN-blocks'
1373
- Enabled: true
1374
-
1375
- Style/BlockComments:
1376
- Description: 'Do not use block comments.'
1377
- StyleGuide: '#no-block-comments'
1378
- Enabled: true
1379
-
1380
- Style/BlockDelimiters:
1381
- Description: >-
1382
- Avoid using {...} for multi-line blocks (multiline chaining is
1383
- always ugly).
1384
- Prefer {...} over do...end for single-line blocks.
1385
- StyleGuide: '#single-line-blocks'
1386
- Enabled: true
1387
-
1388
- Style/BracesAroundHashParameters:
1389
- Description: 'Enforce braces style around hash parameters.'
1390
- Enabled: true
1391
-
1392
- Style/CaseEquality:
1393
- Description: 'Avoid explicit use of the case equality operator(===).'
1394
- StyleGuide: '#no-case-equality'
1395
- Enabled: true
1396
-
1397
- Style/CharacterLiteral:
1398
- Description: 'Checks for uses of character literals.'
1399
- StyleGuide: '#no-character-literals'
1400
- Enabled: true
1401
-
1402
- Style/ClassAndModuleChildren:
1403
- Description: 'Checks style of children classes and modules.'
1404
- StyleGuide: '#namespace-definition'
1405
- # Moving from compact to nested children requires knowledge of whether the
1406
- # outer parent is a module or a class. Moving from nested to compact requires
1407
- # verification that the outer parent is defined elsewhere. Rubocop does not
1408
- # have the knowledge to perform either operation safely and thus requires
1409
- # manual oversight.
1410
- AutoCorrect: false
1411
- Enabled: true
1412
-
1413
- Style/ClassCheck:
1414
- Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
1415
- Enabled: true
1416
-
1417
- Style/ClassMethods:
1418
- Description: 'Use self when defining module/class methods.'
1419
- StyleGuide: '#def-self-class-methods'
1420
- Enabled: true
1421
-
1422
- Style/ClassVars:
1423
- Description: 'Avoid the use of class variables.'
1424
- StyleGuide: '#no-class-vars'
1425
- Enabled: true
1426
-
1427
- Style/ColonMethodCall:
1428
- Description: 'Do not use :: for method call.'
1429
- StyleGuide: '#double-colons'
1430
- Enabled: true
1431
-
1432
- Style/ColonMethodDefinition:
1433
- Description: 'Do not use :: for defining class methods.'
1434
- StyleGuide: '#colon-method-definition'
1435
- Enabled: true
1436
-
1437
- Style/CommandLiteral:
1438
- Description: 'Use `` or %x around command literals.'
1439
- StyleGuide: '#percent-x'
1440
- Enabled: true
1441
-
1442
- Style/CommentAnnotation:
1443
- Description: >-
1444
- Checks formatting of special comments
1445
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
1446
- StyleGuide: '#annotate-keywords'
1447
- Enabled: true
1448
-
1449
- Style/CommentedKeyword:
1450
- Description: 'Do not place comments on the same line as certain keywords.'
1451
- Enabled: true
1452
-
1453
- Style/ConditionalAssignment:
1454
- Description: >-
1455
- Use the return value of `if` and `case` statements for
1456
- assignment to a variable and variable comparison instead
1457
- of assigning that variable inside of each branch.
1458
- Enabled: true
1459
-
1460
- Style/DefWithParentheses:
1461
- Description: 'Use def with parentheses when there are arguments.'
1462
- StyleGuide: '#method-parens'
1463
- Enabled: true
1464
-
1465
- Style/Dir:
1466
- Description: >-
1467
- Use the `__dir__` method to retrieve the canonicalized
1468
- absolute path to the current file.
1469
- Enabled: true
1470
-
1471
- Style/Documentation:
1472
- Description: 'Document classes and non-namespace modules.'
1473
- Enabled: true
1474
- Exclude:
1475
- - 'spec/**/*'
1476
- - 'test/**/*'
1477
-
1478
- Style/DoubleNegation:
1479
- Description: 'Checks for uses of double negation (!!).'
1480
- StyleGuide: '#no-bang-bang'
1481
- Enabled: true
1482
-
1483
- Style/EachForSimpleLoop:
1484
- Description: >-
1485
- Use `Integer#times` for a simple loop which iterates a fixed
1486
- number of times.
1487
- Enabled: true
1488
-
1489
- Style/EachWithObject:
1490
- Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
1491
- Enabled: true
1492
-
1493
- Style/EmptyBlockParameter:
1494
- Description: 'Omit pipes for empty block parameters.'
1495
- Enabled: true
1496
-
1497
- Style/EmptyCaseCondition:
1498
- Description: 'Avoid empty condition in case statements.'
1499
- Enabled: true
1500
-
1501
- Style/EmptyElse:
1502
- Description: 'Avoid empty else-clauses.'
1503
- Enabled: true
1504
-
1505
- Style/EmptyLambdaParameter:
1506
- Description: 'Omit parens for empty lambda parameters.'
1507
- Enabled: true
1508
-
1509
- Style/EmptyLiteral:
1510
- Description: 'Prefer literals to Array.new/Hash.new/String.new.'
1511
- StyleGuide: '#literal-array-hash'
1512
- Enabled: true
1513
-
1514
- Style/EmptyMethod:
1515
- Description: 'Checks the formatting of empty method definitions.'
1516
- StyleGuide: '#no-single-line-methods'
1517
- Enabled: true
1518
-
1519
- Style/Encoding:
1520
- Description: 'Use UTF-8 as the source file encoding.'
1521
- StyleGuide: '#utf-8'
1522
- Enabled: true
1523
-
1524
- Style/EndBlock:
1525
- Description: 'Avoid the use of END blocks.'
1526
- StyleGuide: '#no-END-blocks'
1527
- Enabled: true
1528
-
1529
- Style/EvalWithLocation:
1530
- Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
1531
- Enabled: true
1532
-
1533
- Style/EvenOdd:
1534
- Description: 'Favor the use of Integer#even? && Integer#odd?'
1535
- StyleGuide: '#predicate-methods'
1536
- Enabled: true
1537
-
1538
- Style/ExpandPathArguments:
1539
- Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
1540
- Enabled: true
1541
-
1542
- Style/FlipFlop:
1543
- Description: 'Checks for flip flops'
1544
- StyleGuide: '#no-flip-flops'
1545
- Enabled: true
1546
-
1547
- Style/For:
1548
- Description: 'Checks use of for or each in multiline loops.'
1549
- StyleGuide: '#no-for-loops'
1550
- Enabled: true
1551
-
1552
- Style/FormatString:
1553
- Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
1554
- StyleGuide: '#sprintf'
1555
- Enabled: true
1556
-
1557
- Style/FormatStringToken:
1558
- Description: 'Use a consistent style for format string tokens.'
1559
- Enabled: true
1560
-
1561
- Style/FrozenStringLiteralComment:
1562
- Description: >-
1563
- Add the frozen_string_literal comment to the top of files
1564
- to help transition from Ruby 2.3.0 to Ruby 3.0.
1565
- Enabled: true
1566
-
1567
- Style/GlobalVars:
1568
- Description: 'Do not introduce global variables.'
1569
- StyleGuide: '#instance-vars'
1570
- Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
1571
- Enabled: true
1572
-
1573
- Style/GuardClause:
1574
- Description: 'Check for conditionals that can be replaced with guard clauses'
1575
- StyleGuide: '#no-nested-conditionals'
1576
- Enabled: true
1577
-
1578
- Style/HashSyntax:
1579
- Description: >-
1580
- Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
1581
- { :a => 1, :b => 2 }.
1582
- StyleGuide: '#hash-literals'
1583
- Enabled: true
1584
-
1585
- Style/IdenticalConditionalBranches:
1586
- Description: >-
1587
- Checks that conditional statements do not have an identical
1588
- line at the end of each branch, which can validly be moved
1589
- out of the conditional.
1590
- Enabled: true
1591
-
1592
- Style/IfInsideElse:
1593
- Description: 'Finds if nodes inside else, which can be converted to elsif.'
1594
- Enabled: true
1595
-
1596
- Style/IfUnlessModifier:
1597
- Description: >-
1598
- Favor modifier if/unless usage when you have a
1599
- single-line body.
1600
- StyleGuide: '#if-as-a-modifier'
1601
- Enabled: true
1602
-
1603
- Style/IfUnlessModifierOfIfUnless:
1604
- Description: >-
1605
- Avoid modifier if/unless usage on conditionals.
1606
- Enabled: true
1607
-
1608
- Style/IfWithSemicolon:
1609
- Description: 'Do not use if x; .... Use the ternary operator instead.'
1610
- StyleGuide: '#no-semicolon-ifs'
1611
- Enabled: true
1612
-
1613
- Style/InfiniteLoop:
1614
- Description: 'Use Kernel#loop for infinite loops.'
1615
- StyleGuide: '#infinite-loop'
1616
- Enabled: true
1617
-
1618
- Style/InverseMethods:
1619
- Description: >-
1620
- Use the inverse method instead of `!.method`
1621
- if an inverse method is defined.
1622
- Enabled: true
1623
-
1624
- Style/Lambda:
1625
- Description: 'Use the new lambda literal syntax for single-line blocks.'
1626
- StyleGuide: '#lambda-multi-line'
1627
- Enabled: true
1628
-
1629
- Style/LambdaCall:
1630
- Description: 'Use lambda.call(...) instead of lambda.(...).'
1631
- StyleGuide: '#proc-call'
1632
- Enabled: true
1633
-
1634
- Style/LineEndConcatenation:
1635
- Description: >-
1636
- Use \ instead of + or << to concatenate two string literals at
1637
- line end.
1638
- Enabled: true
1639
-
1640
- Style/MethodCallWithoutArgsParentheses:
1641
- Description: 'Do not use parentheses for method calls with no arguments.'
1642
- StyleGuide: '#method-invocation-parens'
1643
- Enabled: true
1644
-
1645
- Style/MethodDefParentheses:
1646
- Description: >-
1647
- Checks if the method definitions have or don't have
1648
- parentheses.
1649
- StyleGuide: '#method-parens'
1650
- Enabled: true
1651
-
1652
- Style/MethodMissingSuper:
1653
- Description: Checks for `method_missing` to call `super`.
1654
- StyleGuide: '#no-method-missing'
1655
- Enabled: true
1656
-
1657
- Style/MinMax:
1658
- Description: >-
1659
- Use `Enumerable#minmax` instead of `Enumerable#min`
1660
- and `Enumerable#max` in conjunction.'
1661
- Enabled: true
1662
-
1663
- Style/MissingRespondToMissing:
1664
- Description: >-
1665
- Checks if `method_missing` is implemented
1666
- without implementing `respond_to_missing`.
1667
- StyleGuide: '#no-method-missing'
1668
- Enabled: true
1669
-
1670
- Style/MixinGrouping:
1671
- Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
1672
- StyleGuide: '#mixin-grouping'
1673
- Enabled: true
1674
-
1675
- Style/MixinUsage:
1676
- Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
1677
- Enabled: true
1678
-
1679
- Style/ModuleFunction:
1680
- Description: 'Checks for usage of `extend self` in modules.'
1681
- StyleGuide: '#module-function'
1682
- Enabled: true
1683
-
1684
- Style/MultilineBlockChain:
1685
- Description: 'Avoid multi-line chains of blocks.'
1686
- StyleGuide: '#single-line-blocks'
1687
- Enabled: true
1688
-
1689
- Style/MultilineIfModifier:
1690
- Description: 'Only use if/unless modifiers on single line statements.'
1691
- StyleGuide: '#no-multiline-if-modifiers'
1692
- Enabled: true
1693
-
1694
- Style/MultilineIfThen:
1695
- Description: 'Do not use then for multi-line if/unless.'
1696
- StyleGuide: '#no-then'
1697
- Enabled: true
1698
-
1699
- Style/MultilineMemoization:
1700
- Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
1701
- Enabled: true
1702
-
1703
- Style/MultilineTernaryOperator:
1704
- Description: >-
1705
- Avoid multi-line ?: (the ternary operator);
1706
- use if/unless instead.
1707
- StyleGuide: '#no-multiline-ternary'
1708
- Enabled: true
1709
-
1710
- Style/MultipleComparison:
1711
- Description: >-
1712
- Avoid comparing a variable with multiple items in a conditional,
1713
- use Array#include? instead.
1714
- Enabled: true
1715
-
1716
- Style/MutableConstant:
1717
- Description: 'Do not assign mutable objects to constants.'
1718
- Enabled: true
1719
-
1720
- Style/NegatedIf:
1721
- Description: >-
1722
- Favor unless over if for negative conditions
1723
- (or control flow or).
1724
- StyleGuide: '#unless-for-negatives'
1725
- Enabled: true
1726
-
1727
- Style/NegatedWhile:
1728
- Description: 'Favor until over while for negative conditions.'
1729
- StyleGuide: '#until-for-negatives'
1730
- Enabled: true
1731
-
1732
- Style/NestedModifier:
1733
- Description: 'Avoid using nested modifiers.'
1734
- StyleGuide: '#no-nested-modifiers'
1735
- Enabled: true
1736
-
1737
- Style/NestedParenthesizedCalls:
1738
- Description: >-
1739
- Parenthesize method calls which are nested inside the
1740
- argument list of another parenthesized method call.
1741
- Enabled: true
1742
-
1743
- Style/NestedTernaryOperator:
1744
- Description: 'Use one expression per branch in a ternary operator.'
1745
- StyleGuide: '#no-nested-ternary'
1746
- Enabled: true
1747
-
1748
- Style/Next:
1749
- Description: 'Use `next` to skip iteration instead of a condition at the end.'
1750
- StyleGuide: '#no-nested-conditionals'
1751
- Enabled: true
1752
-
1753
- Style/NilComparison:
1754
- Description: 'Prefer x.nil? to x == nil.'
1755
- StyleGuide: '#predicate-methods'
1756
- Enabled: true
1757
-
1758
- Style/NonNilCheck:
1759
- Description: 'Checks for redundant nil checks.'
1760
- StyleGuide: '#no-non-nil-checks'
1761
- Enabled: true
1762
-
1763
- Style/Not:
1764
- Description: 'Use ! instead of not.'
1765
- StyleGuide: '#bang-not-not'
1766
- Enabled: true
1767
-
1768
- Style/NumericLiteralPrefix:
1769
- Description: 'Use smallcase prefixes for numeric literals.'
1770
- StyleGuide: '#numeric-literal-prefixes'
1771
- Enabled: true
1772
-
1773
- Style/NumericLiterals:
1774
- Description: >-
1775
- Add underscores to large numeric literals to improve their
1776
- readability.
1777
- StyleGuide: '#underscores-in-numerics'
1778
- Enabled: true
1779
-
1780
- Style/NumericPredicate:
1781
- Description: >-
1782
- Checks for the use of predicate- or comparison methods for
1783
- numeric comparisons.
1784
- StyleGuide: '#predicate-methods'
1785
- # This will change to a new method call which isn't guaranteed to be on the
1786
- # object. Switching these methods has to be done with knowledge of the types
1787
- # of the variables which rubocop doesn't have.
1788
- AutoCorrect: false
1789
- Enabled: true
1790
-
1791
- Style/OneLineConditional:
1792
- Description: >-
1793
- Favor the ternary operator(?:) over
1794
- if/then/else/end constructs.
1795
- StyleGuide: '#ternary-operator'
1796
- Enabled: true
1797
-
1798
- Style/OptionalArguments:
1799
- Description: >-
1800
- Checks for optional arguments that do not appear at the end
1801
- of the argument list
1802
- StyleGuide: '#optional-arguments'
1803
- Enabled: true
1804
-
1805
- Style/OrAssignment:
1806
- Description: 'Recommend usage of double pipe equals (||=) where applicable.'
1807
- StyleGuide: '#double-pipe-for-uninit'
1808
- Enabled: true
1809
-
1810
- Style/ParallelAssignment:
1811
- Description: >-
1812
- Check for simple usages of parallel assignment.
1813
- It will only warn when the number of variables
1814
- matches on both sides of the assignment.
1815
- StyleGuide: '#parallel-assignment'
1816
- Enabled: true
1817
-
1818
- Style/ParenthesesAroundCondition:
1819
- Description: >-
1820
- Don't use parentheses around the condition of an
1821
- if/unless/while.
1822
- StyleGuide: '#no-parens-around-condition'
1823
- Enabled: true
1824
-
1825
- Style/PercentLiteralDelimiters:
1826
- Description: 'Use `%`-literal delimiters consistently'
1827
- StyleGuide: '#percent-literal-braces'
1828
- Enabled: true
1829
-
1830
- Style/PercentQLiterals:
1831
- Description: 'Checks if uses of %Q/%q match the configured preference.'
1832
- Enabled: true
1833
-
1834
- Style/PerlBackrefs:
1835
- Description: 'Avoid Perl-style regex back references.'
1836
- StyleGuide: '#no-perl-regexp-last-matchers'
1837
- Enabled: true
1838
-
1839
- Style/PreferredHashMethods:
1840
- Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
1841
- StyleGuide: '#hash-key'
1842
- Enabled: true
1843
-
1844
- Style/Proc:
1845
- Description: 'Use proc instead of Proc.new.'
1846
- StyleGuide: '#proc'
1847
- Enabled: true
1848
-
1849
- Style/RaiseArgs:
1850
- Description: 'Checks the arguments passed to raise/fail.'
1851
- StyleGuide: '#exception-class-messages'
1852
- Enabled: true
1853
-
1854
- Style/RandomWithOffset:
1855
- Description: >-
1856
- Prefer to use ranges when generating random numbers instead of
1857
- integers with offsets.
1858
- StyleGuide: '#random-numbers'
1859
- Enabled: true
1860
-
1861
- Style/RedundantBegin:
1862
- Description: "Don't use begin blocks when they are not needed."
1863
- StyleGuide: '#begin-implicit'
1864
- Enabled: true
1865
-
1866
- Style/RedundantConditional:
1867
- Description: "Don't return true/false from a conditional."
1868
- Enabled: true
1869
-
1870
- Style/RedundantException:
1871
- Description: "Checks for an obsolete RuntimeException argument in raise/fail."
1872
- StyleGuide: '#no-explicit-runtimeerror'
1873
- Enabled: true
1874
-
1875
- Style/RedundantFreeze:
1876
- Description: "Checks usages of Object#freeze on immutable objects."
1877
- Enabled: true
1878
-
1879
- Style/RedundantParentheses:
1880
- Description: "Checks for parentheses that seem not to serve any purpose."
1881
- Enabled: true
1882
-
1883
- Style/RedundantReturn:
1884
- Description: "Don't use return where it's not required."
1885
- StyleGuide: '#no-explicit-return'
1886
- Enabled: true
1887
-
1888
- Style/RedundantSelf:
1889
- Description: "Don't use self where it's not needed."
1890
- StyleGuide: '#no-self-unless-required'
1891
- Enabled: true
1892
-
1893
- Style/RegexpLiteral:
1894
- Description: 'Use / or %r around regular expressions.'
1895
- StyleGuide: '#percent-r'
1896
- Enabled: true
1897
-
1898
- Style/RescueModifier:
1899
- Description: 'Avoid using rescue in its modifier form.'
1900
- StyleGuide: '#no-rescue-modifiers'
1901
- Enabled: true
1902
-
1903
- Style/RescueStandardError:
1904
- Description: 'Avoid rescuing without specifying an error class.'
1905
- Enabled: true
1906
-
1907
- Style/SafeNavigation:
1908
- Description: >-
1909
- This cop transforms usages of a method call safeguarded by
1910
- a check for the existence of the object to
1911
- safe navigation (`&.`).
1912
- Enabled: true
1913
-
1914
- Style/SelfAssignment:
1915
- Description: >-
1916
- Checks for places where self-assignment shorthand should have
1917
- been used.
1918
- StyleGuide: '#self-assignment'
1919
- Enabled: true
1920
-
1921
- Style/Semicolon:
1922
- Description: "Don't use semicolons to terminate expressions."
1923
- StyleGuide: '#no-semicolon'
1924
- Enabled: true
1925
-
1926
- Style/SignalException:
1927
- Description: 'Checks for proper usage of fail and raise.'
1928
- StyleGuide: '#prefer-raise-over-fail'
1929
- Enabled: true
1930
-
1931
- Style/SingleLineMethods:
1932
- Description: 'Avoid single-line methods.'
1933
- StyleGuide: '#no-single-line-methods'
1934
- Enabled: true
1935
-
1936
- Style/SpecialGlobalVars:
1937
- Description: 'Avoid Perl-style global variables.'
1938
- StyleGuide: '#no-cryptic-perlisms'
1939
- Enabled: true
1940
-
1941
- Style/StabbyLambdaParentheses:
1942
- Description: 'Check for the usage of parentheses around stabby lambda arguments.'
1943
- StyleGuide: '#stabby-lambda-with-args'
1944
- Enabled: true
1945
-
1946
- Style/StderrPuts:
1947
- Description: 'Use `warn` instead of `$stderr.puts`.'
1948
- StyleGuide: '#warn'
1949
- Enabled: true
1950
-
1951
- Style/StringLiterals:
1952
- Description: 'Checks if uses of quotes match the configured preference.'
1953
- StyleGuide: '#consistent-string-literals'
1954
- Enabled: true
1955
-
1956
- Style/StringLiteralsInInterpolation:
1957
- Description: >-
1958
- Checks if uses of quotes inside expressions in interpolated
1959
- strings match the configured preference.
1960
- Enabled: true
1961
-
1962
- Style/StructInheritance:
1963
- Description: 'Checks for inheritance from Struct.new.'
1964
- StyleGuide: '#no-extend-struct-new'
1965
- Enabled: true
1966
-
1967
- Style/SymbolArray:
1968
- Description: 'Use %i or %I for arrays of symbols.'
1969
- StyleGuide: '#percent-i'
1970
- Enabled: true
1971
-
1972
- Style/SymbolLiteral:
1973
- Description: 'Use plain symbols instead of string symbols when possible.'
1974
- Enabled: true
1975
-
1976
- Style/SymbolProc:
1977
- Description: 'Use symbols as procs instead of blocks when possible.'
1978
- Enabled: true
1979
-
1980
- Style/TernaryParentheses:
1981
- Description: 'Checks for use of parentheses around ternary conditions.'
1982
- Enabled: true
1983
-
1984
- Style/TrailingBodyOnClass:
1985
- Description: 'Class body goes below class statement.'
1986
- Enabled: true
1987
-
1988
- Style/TrailingBodyOnMethodDefinition:
1989
- Description: 'Method body goes below definition.'
1990
- Enabled: true
1991
-
1992
- Style/TrailingBodyOnModule:
1993
- Description: 'Module body goes below module statement.'
1994
- Enabled: true
1995
-
1996
- Style/TrailingCommaInArguments:
1997
- Description: 'Checks for trailing comma in argument lists.'
1998
- StyleGuide: '#no-trailing-params-comma'
1999
- Enabled: true
2000
-
2001
- Style/TrailingCommaInArrayLiteral:
2002
- Description: 'Checks for trailing comma in array literals.'
2003
- StyleGuide: '#no-trailing-array-commas'
2004
- Enabled: true
2005
-
2006
- Style/TrailingCommaInHashLiteral:
2007
- Description: 'Checks for trailing comma in hash literals.'
2008
- Enabled: true
2009
-
2010
- Style/TrailingMethodEndStatement:
2011
- Description: 'Checks for trailing end statement on line of method body.'
2012
- Enabled: true
2013
-
2014
- Style/TrailingUnderscoreVariable:
2015
- Description: >-
2016
- Checks for the usage of unneeded trailing underscores at the
2017
- end of parallel variable assignment.
2018
- AllowNamedUnderscoreVariables: true
2019
- Enabled: true
2020
-
2021
- Style/TrivialAccessors:
2022
- Description: 'Prefer attr_* methods to trivial readers/writers.'
2023
- StyleGuide: '#attr_family'
2024
- Enabled: true
2025
-
2026
- Style/UnlessElse:
2027
- Description: >-
2028
- Do not use unless with else. Rewrite these with the positive
2029
- case first.
2030
- StyleGuide: '#no-else-with-unless'
2031
- Enabled: true
2032
-
2033
- Style/UnneededCapitalW:
2034
- Description: 'Checks for %W when interpolation is not needed.'
2035
- Enabled: true
2036
-
2037
- Style/UnneededCondition:
2038
- Description: 'Checks for unnecessary conditional expressions.'
2039
- Enabled: true
2040
-
2041
- Style/UnneededInterpolation:
2042
- Description: 'Checks for strings that are just an interpolated expression.'
2043
- Enabled: true
2044
-
2045
- Style/UnneededPercentQ:
2046
- Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
2047
- StyleGuide: '#percent-q'
2048
- Enabled: true
2049
-
2050
- Style/UnpackFirst:
2051
- Description: >-
2052
- Checks for accessing the first element of `String#unpack`
2053
- instead of using `unpack1`
2054
- Enabled: true
2055
-
2056
- Style/VariableInterpolation:
2057
- Description: >-
2058
- Don't interpolate global, instance and class variables
2059
- directly in strings.
2060
- StyleGuide: '#curlies-interpolate'
2061
- Enabled: true
2062
-
2063
- Style/WhenThen:
2064
- Description: 'Use when x then ... for one-line cases.'
2065
- StyleGuide: '#one-line-cases'
2066
- Enabled: true
2067
-
2068
- Style/WhileUntilDo:
2069
- Description: 'Checks for redundant do after while or until.'
2070
- StyleGuide: '#no-multiline-while-do'
2071
- Enabled: true
2072
-
2073
- Style/WhileUntilModifier:
2074
- Description: >-
2075
- Favor modifier while/until usage when you have a
2076
- single-line body.
2077
- StyleGuide: '#while-as-a-modifier'
2078
- Enabled: true
2079
-
2080
- Style/WordArray:
2081
- Description: 'Use %w or %W for arrays of words.'
2082
- StyleGuide: '#percent-w'
2083
- Enabled: true
2084
-
2085
- Style/YodaCondition:
2086
- Description: 'Do not use literals as the first operand of a comparison.'
2087
- Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
2088
- Enabled: true
2089
-
2090
- Style/ZeroLengthPredicate:
2091
- Description: 'Use #empty? when testing for objects of length 0.'
2092
- Enabled: true