rubocop-callbacksystems 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +78 -0
  4. data/config/default.yml +590 -0
  5. data/docs/cops.md +111 -0
  6. data/lib/rubocop/callbacksystems/autocorrection/batch.rb +135 -0
  7. data/lib/rubocop/callbacksystems/autocorrection/comment_rescue.rb +112 -0
  8. data/lib/rubocop/callbacksystems/autocorrection/rehearsal.rb +65 -0
  9. data/lib/rubocop/callbacksystems/autocorrection/rewrite_permit.rb +14 -0
  10. data/lib/rubocop/callbacksystems/class_structure/builder_assignment.rb +48 -0
  11. data/lib/rubocop/callbacksystems/class_structure/class_body.rb +50 -0
  12. data/lib/rubocop/callbacksystems/class_structure/divergence.rb +31 -0
  13. data/lib/rubocop/callbacksystems/class_structure/node_visibility.rb +82 -0
  14. data/lib/rubocop/callbacksystems/class_structure/reference_order.rb +36 -0
  15. data/lib/rubocop/callbacksystems/class_structure/statement_rank.rb +84 -0
  16. data/lib/rubocop/callbacksystems/class_structure/statement_run.rb +42 -0
  17. data/lib/rubocop/callbacksystems/class_structure/visibility.rb +84 -0
  18. data/lib/rubocop/callbacksystems/cops_document.rb +78 -0
  19. data/lib/rubocop/callbacksystems/execution/deferred_local_variables.rb +138 -0
  20. data/lib/rubocop/callbacksystems/execution/discarded_expression.rb +45 -0
  21. data/lib/rubocop/callbacksystems/execution/eager_evaluation_path.rb +73 -0
  22. data/lib/rubocop/callbacksystems/execution/immediate.rb +71 -0
  23. data/lib/rubocop/callbacksystems/execution/local_variable_occurrences.rb +112 -0
  24. data/lib/rubocop/callbacksystems/hashes/key_transform_detection.rb +108 -0
  25. data/lib/rubocop/callbacksystems/hashes/keyword_options.rb +37 -0
  26. data/lib/rubocop/callbacksystems/helpers/bodies.rb +150 -0
  27. data/lib/rubocop/callbacksystems/helpers/builders.rb +103 -0
  28. data/lib/rubocop/callbacksystems/helpers/comments.rb +56 -0
  29. data/lib/rubocop/callbacksystems/helpers/corrections.rb +15 -0
  30. data/lib/rubocop/callbacksystems/helpers/methods.rb +46 -0
  31. data/lib/rubocop/callbacksystems/helpers/names.rb +65 -0
  32. data/lib/rubocop/callbacksystems/helpers/node_types.rb +154 -0
  33. data/lib/rubocop/callbacksystems/helpers/rails.rb +52 -0
  34. data/lib/rubocop/callbacksystems/helpers/ranges.rb +107 -0
  35. data/lib/rubocop/callbacksystems/helpers/recursion.rb +29 -0
  36. data/lib/rubocop/callbacksystems/helpers/variables.rb +44 -0
  37. data/lib/rubocop/callbacksystems/helpers/visibility.rb +121 -0
  38. data/lib/rubocop/callbacksystems/helpers.rb +43 -0
  39. data/lib/rubocop/callbacksystems/methods/calls.rb +38 -0
  40. data/lib/rubocop/callbacksystems/methods/definitions.rb +218 -0
  41. data/lib/rubocop/callbacksystems/methods/delegate_macro.rb +144 -0
  42. data/lib/rubocop/callbacksystems/methods/delegation_target.rb +55 -0
  43. data/lib/rubocop/callbacksystems/methods/domain.rb +77 -0
  44. data/lib/rubocop/callbacksystems/methods/implicit_invocations.rb +17 -0
  45. data/lib/rubocop/callbacksystems/methods/macro_references.rb +238 -0
  46. data/lib/rubocop/callbacksystems/methods/reference_evidence.rb +74 -0
  47. data/lib/rubocop/callbacksystems/methods/siblings.rb +24 -0
  48. data/lib/rubocop/callbacksystems/methods/statement_definitions.rb +68 -0
  49. data/lib/rubocop/callbacksystems/offense.rb +13 -0
  50. data/lib/rubocop/callbacksystems/plugin.rb +27 -0
  51. data/lib/rubocop/callbacksystems/project_index/cache.rb +16 -0
  52. data/lib/rubocop/callbacksystems/project_index/confinement_cache.rb +40 -0
  53. data/lib/rubocop/callbacksystems/project_index/constant_references.rb +74 -0
  54. data/lib/rubocop/callbacksystems/project_index/corrections.rb +35 -0
  55. data/lib/rubocop/callbacksystems/project_index/coverage.rb +56 -0
  56. data/lib/rubocop/callbacksystems/project_index/diagnostics.rb +60 -0
  57. data/lib/rubocop/callbacksystems/project_index/freshness.rb +104 -0
  58. data/lib/rubocop/callbacksystems/project_index/loader.rb +9 -0
  59. data/lib/rubocop/callbacksystems/project_index/location.rb +29 -0
  60. data/lib/rubocop/callbacksystems/project_index/nested_class_confinement.rb +297 -0
  61. data/lib/rubocop/callbacksystems/project_index/nested_class_method_dispatch.rb +50 -0
  62. data/lib/rubocop/callbacksystems/project_index/reading.rb +129 -0
  63. data/lib/rubocop/callbacksystems/project_index/source_file.rb +59 -0
  64. data/lib/rubocop/callbacksystems/project_index/source_file_match.rb +57 -0
  65. data/lib/rubocop/callbacksystems/project_index/support.rb +46 -0
  66. data/lib/rubocop/callbacksystems/source/comment_blocks.rb +43 -0
  67. data/lib/rubocop/callbacksystems/source/comments.rb +141 -0
  68. data/lib/rubocop/callbacksystems/source/file_ast.rb +15 -0
  69. data/lib/rubocop/callbacksystems/source/files_checksum.rb +43 -0
  70. data/lib/rubocop/callbacksystems/source/single_line_call.rb +181 -0
  71. data/lib/rubocop/callbacksystems/source/statement_with_comments.rb +131 -0
  72. data/lib/rubocop/callbacksystems/testing/cop_helpers.rb +42 -0
  73. data/lib/rubocop/callbacksystems/testing/fixture_call.rb +30 -0
  74. data/lib/rubocop/callbacksystems/testing/fixture_names.rb +62 -0
  75. data/lib/rubocop/callbacksystems/testing/path_mapping.rb +104 -0
  76. data/lib/rubocop/cop/callbacksystems/application_controller_method_definition.rb +44 -0
  77. data/lib/rubocop/cop/callbacksystems/assert_with_expected_argument.rb +60 -0
  78. data/lib/rubocop/cop/callbacksystems/base.rb +134 -0
  79. data/lib/rubocop/cop/callbacksystems/body_order.rb +478 -0
  80. data/lib/rubocop/cop/callbacksystems/builder_method_parentheses.rb +74 -0
  81. data/lib/rubocop/cop/callbacksystems/collapse_multiline_expression.rb +140 -0
  82. data/lib/rubocop/cop/callbacksystems/comment_block_length.rb +137 -0
  83. data/lib/rubocop/cop/callbacksystems/complex_conditional.rb +75 -0
  84. data/lib/rubocop/cop/callbacksystems/controller_test_response_assertion.rb +105 -0
  85. data/lib/rubocop/cop/callbacksystems/controller_test_response_first_assertion.rb +123 -0
  86. data/lib/rubocop/cop/callbacksystems/data_clump.rb +339 -0
  87. data/lib/rubocop/cop/callbacksystems/declarative_method_naming.rb +350 -0
  88. data/lib/rubocop/cop/callbacksystems/delegate_requires_private_option.rb +81 -0
  89. data/lib/rubocop/cop/callbacksystems/eager_loading_scope_naming.rb +386 -0
  90. data/lib/rubocop/cop/callbacksystems/early_return.rb +215 -0
  91. data/lib/rubocop/cop/callbacksystems/empty_line_before_method.rb +168 -0
  92. data/lib/rubocop/cop/callbacksystems/empty_line_between_sections.rb +169 -0
  93. data/lib/rubocop/cop/callbacksystems/empty_private_section.rb +107 -0
  94. data/lib/rubocop/cop/callbacksystems/expanded_empty_class_or_module.rb +71 -0
  95. data/lib/rubocop/cop/callbacksystems/inline_memoized_computation.rb +110 -0
  96. data/lib/rubocop/cop/callbacksystems/job_enqueue_methods.rb +93 -0
  97. data/lib/rubocop/cop/callbacksystems/max_safe_navigation_depth.rb +118 -0
  98. data/lib/rubocop/cop/callbacksystems/method_invocation_order.rb +261 -0
  99. data/lib/rubocop/cop/callbacksystems/nested_class_order.rb +255 -0
  100. data/lib/rubocop/cop/callbacksystems/no_abbreviations.rb +197 -0
  101. data/lib/rubocop/cop/callbacksystems/no_anemic_delegation.rb +101 -0
  102. data/lib/rubocop/cop/callbacksystems/no_anemic_record.rb +309 -0
  103. data/lib/rubocop/cop/callbacksystems/no_assert_select.rb +31 -0
  104. data/lib/rubocop/cop/callbacksystems/no_bang_method_without_counterpart.rb +451 -0
  105. data/lib/rubocop/cop/callbacksystems/no_call_method.rb +73 -0
  106. data/lib/rubocop/cop/callbacksystems/no_comments_in_test_class_body.rb +159 -0
  107. data/lib/rubocop/cop/callbacksystems/no_consecutive_appends.rb +261 -0
  108. data/lib/rubocop/cop/callbacksystems/no_custom_route_actions.rb +124 -0
  109. data/lib/rubocop/cop/callbacksystems/no_direct_eager_loading.rb +90 -0
  110. data/lib/rubocop/cop/callbacksystems/no_each_with_early_return.rb +58 -0
  111. data/lib/rubocop/cop/callbacksystems/no_explicit_public_modifier.rb +81 -0
  112. data/lib/rubocop/cop/callbacksystems/no_hash_with_default_block.rb +68 -0
  113. data/lib/rubocop/cop/callbacksystems/no_local_variable_return.rb +173 -0
  114. data/lib/rubocop/cop/callbacksystems/no_manual_accumulation.rb +188 -0
  115. data/lib/rubocop/cop/callbacksystems/no_mixed_memoization.rb +145 -0
  116. data/lib/rubocop/cop/callbacksystems/no_nested_modules_in_classes.rb +78 -0
  117. data/lib/rubocop/cop/callbacksystems/no_nil_at_end_of_method.rb +74 -0
  118. data/lib/rubocop/cop/callbacksystems/no_redundant_validation_name.rb +37 -0
  119. data/lib/rubocop/cop/callbacksystems/no_redundant_wrapper_method.rb +161 -0
  120. data/lib/rubocop/cop/callbacksystems/no_section_divider_comments.rb +105 -0
  121. data/lib/rubocop/cop/callbacksystems/no_send_in_tests.rb +75 -0
  122. data/lib/rubocop/cop/callbacksystems/no_service_objects.rb +64 -0
  123. data/lib/rubocop/cop/callbacksystems/no_single_letter_names.rb +47 -0
  124. data/lib/rubocop/cop/callbacksystems/no_singleton_class_in_modules.rb +43 -0
  125. data/lib/rubocop/cop/callbacksystems/no_tap_collection_building.rb +173 -0
  126. data/lib/rubocop/cop/callbacksystems/no_turbo_stream_in_controllers.rb +52 -0
  127. data/lib/rubocop/cop/callbacksystems/no_typographic_clutter.rb +159 -0
  128. data/lib/rubocop/cop/callbacksystems/no_writes_in_get_actions.rb +149 -0
  129. data/lib/rubocop/cop/callbacksystems/ordered_mixin_arguments.rb +78 -0
  130. data/lib/rubocop/cop/callbacksystems/plural_controller_names.rb +103 -0
  131. data/lib/rubocop/cop/callbacksystems/prefer_attr_reader_over_instance_variable.rb +86 -0
  132. data/lib/rubocop/cop/callbacksystems/prefer_backslash_continuation.rb +478 -0
  133. data/lib/rubocop/cop/callbacksystems/prefer_class_for_state.rb +532 -0
  134. data/lib/rubocop/cop/callbacksystems/prefer_class_new_for_empty_nested_class.rb +247 -0
  135. data/lib/rubocop/cop/callbacksystems/prefer_class_over_builder_block.rb +124 -0
  136. data/lib/rubocop/cop/callbacksystems/prefer_default_argument.rb +225 -0
  137. data/lib/rubocop/cop/callbacksystems/prefer_delegate.rb +242 -0
  138. data/lib/rubocop/cop/callbacksystems/prefer_delegate_over_instance_variable_assignment.rb +175 -0
  139. data/lib/rubocop/cop/callbacksystems/prefer_excluding.rb +204 -0
  140. data/lib/rubocop/cop/callbacksystems/prefer_extract_associated.rb +54 -0
  141. data/lib/rubocop/cop/callbacksystems/prefer_it_block_parameter.rb +156 -0
  142. data/lib/rubocop/cop/callbacksystems/prefer_many.rb +57 -0
  143. data/lib/rubocop/cop/callbacksystems/prefer_method_over_lambda.rb +211 -0
  144. data/lib/rubocop/cop/callbacksystems/prefer_method_over_variable.rb +172 -0
  145. data/lib/rubocop/cop/callbacksystems/prefer_module_for_static_class.rb +286 -0
  146. data/lib/rubocop/cop/callbacksystems/prefer_ordinal_array_access.rb +136 -0
  147. data/lib/rubocop/cop/callbacksystems/prefer_positive_wrap.rb +265 -0
  148. data/lib/rubocop/cop/callbacksystems/prefer_squish.rb +47 -0
  149. data/lib/rubocop/cop/callbacksystems/prefer_stringify_keys.rb +24 -0
  150. data/lib/rubocop/cop/callbacksystems/prefer_symbolize_keys.rb +24 -0
  151. data/lib/rubocop/cop/callbacksystems/prefer_turbo_page_refresh_broadcasts.rb +40 -0
  152. data/lib/rubocop/cop/callbacksystems/private_constants_in_private_section.rb +160 -0
  153. data/lib/rubocop/cop/callbacksystems/private_delegate_placement.rb +342 -0
  154. data/lib/rubocop/cop/callbacksystems/private_methods_in_private_section.rb +70 -0
  155. data/lib/rubocop/cop/callbacksystems/private_nested_class_method_visibility.rb +269 -0
  156. data/lib/rubocop/cop/callbacksystems/private_nested_classes.rb +94 -0
  157. data/lib/rubocop/cop/callbacksystems/public_methods_must_have_tests.rb +190 -0
  158. data/lib/rubocop/cop/callbacksystems/redundant_concern_extend.rb +157 -0
  159. data/lib/rubocop/cop/callbacksystems/redundant_constant_freeze.rb +57 -0
  160. data/lib/rubocop/cop/callbacksystems/redundant_constant_namespace.rb +134 -0
  161. data/lib/rubocop/cop/callbacksystems/reflow_comments.rb +133 -0
  162. data/lib/rubocop/cop/callbacksystems/repeated_fixture_in_tests.rb +106 -0
  163. data/lib/rubocop/cop/callbacksystems/restricted_controller_actions.rb +85 -0
  164. data/lib/rubocop/cop/callbacksystems/routes_module_scope.rb +336 -0
  165. data/lib/rubocop/cop/callbacksystems/single_line_setup_block.rb +107 -0
  166. data/lib/rubocop/cop/callbacksystems/single_singleton_class.rb +49 -0
  167. data/lib/rubocop/cop/callbacksystems/single_top_level_class_or_module.rb +160 -0
  168. data/lib/rubocop/cop/callbacksystems/single_use_fixture_variable.rb +211 -0
  169. data/lib/rubocop/cop/callbacksystems/single_use_setup_variable.rb +684 -0
  170. data/lib/rubocop/cop/callbacksystems/singular_scope_names.rb +47 -0
  171. data/lib/rubocop/cop/callbacksystems/space_inside_percent_literal.rb +73 -0
  172. data/lib/rubocop/cop/callbacksystems/system_test_browser_driver.rb +30 -0
  173. data/lib/rubocop/cop/callbacksystems/test_method_definition.rb +86 -0
  174. data/lib/rubocop/cop/callbacksystems/test_method_order.rb +319 -0
  175. data/lib/rubocop/cop/callbacksystems/too_many_instance_variables.rb +78 -0
  176. data/lib/rubocop/cop/callbacksystems/too_many_local_variables.rb +77 -0
  177. data/lib/rubocop/cop/callbacksystems/too_many_validation_guards.rb +84 -0
  178. data/lib/rubocop/cop/callbacksystems/unnecessary_local_variable.rb +176 -0
  179. data/lib/rubocop/cop/callbacksystems/unused_private_method_in_nested_class.rb +203 -0
  180. data/lib/rubocop-callbacksystems.rb +21 -0
  181. data/rubocop.yml +685 -0
  182. metadata +337 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a6b9c7d809122b037510f6454b6d1d106aaa5b5a4bf13b2fd499bbbd9d3dd0a6
4
+ data.tar.gz: d534eb5078807946aa6bd82825fd8baf7e2a7569b7c468fc9a6737d2caf4aabc
5
+ SHA512:
6
+ metadata.gz: 1c5b33028a854456106a5305996524a9f479c6eb472f9b4aeb364c4c6cb7931f42632a97615ac490b031b945ece381910ea49b501975fff305811560f5f28407
7
+ data.tar.gz: 797c033f4469c2c30efa35a5e40a17ce00ef2d3ff31cd6958c326addee390194f638217b745c26909df115f824092a4d507be7f28bcec8ace09938623d8f7f0f
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Callbacksystems
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # rubocop-callbacksystems
2
+
3
+ A RuboCop plugin for the Callback Systems Ruby style in Rails applications and Ruby gems. It includes the
4
+ `Callbacksystems/` cops and a shared configuration for RuboCop, rubocop-rails, rubocop-performance and rubocop-minitest.
5
+
6
+ ## Installation
7
+
8
+ You'll need Ruby 4.0 or newer and RuboCop 1.89 or newer. Add the gem to your Gemfile and run `bundle install`:
9
+
10
+ ```ruby
11
+ # Gemfile
12
+ gem "rubocop-callbacksystems", require: false
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ Add the shared configuration to your `.rubocop.yml`:
18
+
19
+ ```yaml
20
+ inherit_gem:
21
+ rubocop-callbacksystems: rubocop.yml
22
+ ```
23
+
24
+ This loads the plugin, enables every `Callbacksystems/` cop and applies the shared configuration. Run RuboCop with:
25
+
26
+ ```bash
27
+ bundle exec rubocop
28
+ ```
29
+
30
+ To use the cops with your own RuboCop configuration, load just the plugin:
31
+
32
+ ```yaml
33
+ plugins:
34
+ - rubocop-callbacksystems
35
+ ```
36
+
37
+ ## Cops
38
+
39
+ Most cops apply to `app/`, `lib/` or `test/`. See [the cop reference](docs/cops.md) for the rules and
40
+ [`config/default.yml`](config/default.yml) for their options and paths.
41
+
42
+ ## Active Support
43
+
44
+ The cops recommend Active Support methods such as `many?`, `excluding`, `squish`, ordinal array readers,
45
+ `stringify_keys` and `symbolize_keys`. Rails loads these when it boots. In a plain Ruby application or gem, require
46
+ `active_support/all` or the corresponding `active_support/core_ext` files at runtime. Loading the plugin for linting
47
+ does not make these methods available in your application.
48
+
49
+ ## Customizing
50
+
51
+ Override inherited settings in your `.rubocop.yml`:
52
+
53
+ ```yaml
54
+ inherit_gem:
55
+ rubocop-callbacksystems: rubocop.yml
56
+
57
+ Callbacksystems/NoAbbreviations:
58
+ Enabled: false
59
+
60
+ Callbacksystems/TooManyLocalVariables:
61
+ MaxAssignments: 4
62
+ ```
63
+
64
+ ## Development
65
+
66
+ ```bash
67
+ bundle install
68
+ bin/test # run the test suite
69
+ bin/coverage # run the suite measuring lines, branches and methods
70
+ bin/rubocop # lint the gem with its own cops
71
+ bin/docs # regenerate the cop reference
72
+ ```
73
+
74
+ The test suite checks that `docs/cops.md` matches the cops. Run `bin/docs` after changing a cop's documentation.
75
+
76
+ ## License
77
+
78
+ Released under the [MIT License](LICENSE).
@@ -0,0 +1,590 @@
1
+ inherit_mode:
2
+ merge:
3
+ - Exclude
4
+ - Include
5
+
6
+ AllCops:
7
+ ActiveSupportExtensionsEnabled: true
8
+ UseProjectIndex: true
9
+
10
+ Callbacksystems/ApplicationControllerMethodDefinition:
11
+ Description: "Prohibits defining methods directly in ApplicationController."
12
+ Enabled: true
13
+ Include:
14
+ - "app/controllers/application_controller.rb"
15
+
16
+ Callbacksystems/AssertWithExpectedArgument:
17
+ Description: "Flags a two-argument `assert` whose second argument is not a failure message."
18
+ Enabled: true
19
+ Safe: false
20
+
21
+ Callbacksystems/BodyOrder:
22
+ Description: "Orders a class body: mixins, constants, class declarations, state declarations, associations, delegates, macros, methods, nested classes."
23
+ Enabled: true
24
+ SafeAutoCorrect: false
25
+
26
+ Callbacksystems/BuilderMethodParentheses:
27
+ Description: "Requires parentheses on builder method calls that take arguments."
28
+ Enabled: true
29
+ SafeAutoCorrect: true
30
+ Exclude:
31
+ - "app/helpers/**/*"
32
+
33
+ Callbacksystems/CollapseMultilineExpression:
34
+ Description: "Collapses multiline expressions that fit on a single line."
35
+ Enabled: true
36
+ SafeAutoCorrect: true
37
+
38
+ Callbacksystems/CommentBlockLength:
39
+ Description: "Limits how many lines a comment block takes."
40
+ Enabled: true
41
+ Max: 2
42
+ HeaderMax: 4
43
+
44
+ Callbacksystems/ComplexConditional:
45
+ Description: "Limits boolean operators in a conditional, so predicates get extracted."
46
+ Enabled: true
47
+ MaxOperators: 1
48
+
49
+ Callbacksystems/ControllerTestResponseAssertion:
50
+ Description: "Requires every controller test that makes a request to assert the response."
51
+ Enabled: true
52
+ Safe: false
53
+ Include:
54
+ - "test/controllers/**/*"
55
+
56
+ Callbacksystems/ControllerTestResponseFirstAssertion:
57
+ Description: "Requires the response assertion to come first after a request in controller tests."
58
+ Enabled: true
59
+ Safe: false
60
+ Include:
61
+ - "test/controllers/**/*"
62
+
63
+ Callbacksystems/DataClump:
64
+ Description: "Detects parameter names that travel together across private methods and belong in an object of their own."
65
+ Enabled: true
66
+ Safe: false
67
+ MinMethods: 3
68
+ MinMethodsForRepeatedSignature: 2
69
+ MinMethodsForSingleParam: 6
70
+
71
+ Callbacksystems/DeclarativeMethodNaming:
72
+ Description: "Requires a value-returning method to be named for the value, not the action."
73
+ Enabled: true
74
+ Safe: false
75
+
76
+ Callbacksystems/DelegateRequiresPrivateOption:
77
+ Description: "Requires `private: true` on a `delegate` that stands in the private section."
78
+ Enabled: true
79
+ SafeAutoCorrect: false
80
+
81
+ Callbacksystems/EagerLoadingScopeNaming:
82
+ Description: "Reserves `with_*` for eager loading scopes and requires specific association names."
83
+ Enabled: true
84
+ Include:
85
+ - "app/models/**/*"
86
+
87
+ Callbacksystems/EarlyReturn:
88
+ Description: "Allows a single guard clause on the first line as the only early exit."
89
+ Enabled: true
90
+
91
+ Callbacksystems/EmptyLineBeforeMethod:
92
+ Description: "Requires an empty line before a method definition."
93
+ Enabled: true
94
+ SafeAutoCorrect: true
95
+ DescribingMacros:
96
+ - desc
97
+ - long_desc
98
+ - method_option
99
+ - method_options
100
+ - option
101
+
102
+ Callbacksystems/EmptyLineBetweenSections:
103
+ Description: "Requires a blank line between two adjacent statements of different sections of a class body."
104
+ Enabled: true
105
+ SafeAutoCorrect: true
106
+
107
+ Callbacksystems/EmptyPrivateSection:
108
+ Description: "Flags a `private` keyword that declares an empty section."
109
+ Enabled: true
110
+ SafeAutoCorrect: false
111
+
112
+ Callbacksystems/ExpandedEmptyClassOrModule:
113
+ Description: "Requires an empty class or module to keep its `end` on a line of its own."
114
+ Enabled: true
115
+ SafeAutoCorrect: true
116
+
117
+ Callbacksystems/InlineMemoizedComputation:
118
+ Description: "Requires the computation to be inlined in the method that memoizes it."
119
+ Enabled: true
120
+ Safe: false
121
+
122
+ Callbacksystems/JobEnqueueMethods:
123
+ Description: "Requires a method that enqueues a job to carry the `_later` suffix."
124
+ Enabled: true
125
+ Safe: false
126
+ Include:
127
+ - "app/models/**/*"
128
+
129
+ Callbacksystems/MaxSafeNavigationDepth:
130
+ Description: "Limits the depth of a chain of safe navigation calls."
131
+ Enabled: true
132
+ MaxDepth: 3
133
+
134
+ Callbacksystems/MethodInvocationOrder:
135
+ Description: "Requires methods to be ordered by invocation, each caller before its callees."
136
+ Enabled: true
137
+ SafeAutoCorrect: false
138
+
139
+ Callbacksystems/NestedClassOrder:
140
+ Description: "Requires nested classes to be ordered by reference, each before the ones it names."
141
+ Enabled: true
142
+ SafeAutoCorrect: false
143
+
144
+ Callbacksystems/NoAbbreviations:
145
+ Description: "Requires full words in declared names, including CamelCase, while preserving Ruby and Rails vocabulary."
146
+ Enabled: true
147
+
148
+ Callbacksystems/NoAnemicDelegation:
149
+ Description: "Flags a private method that only delegates to a freshly built object."
150
+ Enabled: true
151
+
152
+ Callbacksystems/NoAnemicRecord:
153
+ Description: "Detects a hash literal of several fields read across methods, which reads better as a class."
154
+ Enabled: true
155
+ Safe: false
156
+ MinFields: 3
157
+ MinReaders: 2
158
+
159
+ Callbacksystems/NoAssertSelect:
160
+ Description: "Prohibits `assert_select` in tests."
161
+ Enabled: true
162
+ Include:
163
+ - "test/**/*"
164
+
165
+ Callbacksystems/NoBangMethodWithoutCounterpart:
166
+ Description: "Prohibits a bang method without a non-bang counterpart."
167
+ Enabled: true
168
+ Safe: false
169
+
170
+ Callbacksystems/NoCallMethod:
171
+ Description: "Prohibits defining a method named `call`, except for Rack middleware endpoints."
172
+ Enabled: true
173
+
174
+ Callbacksystems/NoCommentsInTestClassBody:
175
+ Description: "Prohibits comments in the direct body of a test class."
176
+ Enabled: true
177
+ Include:
178
+ - "test/**/*"
179
+
180
+ Callbacksystems/NoConsecutiveAppends:
181
+ Description: "Collapses consecutive appends to one collection into a single `push`."
182
+ Enabled: true
183
+ Safe: false
184
+ SafeAutoCorrect: false
185
+
186
+ Callbacksystems/NoCustomRouteActions:
187
+ Description: "Keeps routes on the standard resource actions."
188
+ Enabled: true
189
+ Include:
190
+ - "config/routes.rb"
191
+ - "config/routes/**/*"
192
+
193
+ Callbacksystems/NoDirectEagerLoading:
194
+ Description: "Keeps `preload`, `eager_load`, and `includes` inside `app/models` behind named scopes."
195
+ Enabled: true
196
+ Safe: false
197
+
198
+ Callbacksystems/NoEachWithEarlyReturn:
199
+ Description: "Prefers `find` over an `each` block with a conditional early return."
200
+ Enabled: true
201
+ Safe: false
202
+
203
+ Callbacksystems/NoExplicitPublicModifier:
204
+ Description: "Prohibits the explicit `public` modifier."
205
+ Enabled: true
206
+ SafeAutoCorrect: false
207
+
208
+ Callbacksystems/NoHashWithDefaultBlock:
209
+ Description: "Prefers declarative grouping over `Hash.new` with a default block."
210
+ Enabled: true
211
+
212
+ Callbacksystems/NoLocalVariableReturn:
213
+ Description: "Prohibits returning a local variable as the last statement of a method."
214
+ Enabled: true
215
+ SafeAutoCorrect: true
216
+
217
+ Callbacksystems/NoManualAccumulation:
218
+ Description: "Prefers declarative collection methods over filling an empty array or hash inside `each`."
219
+ Enabled: true
220
+ Safe: false
221
+
222
+ Callbacksystems/NoMixedMemoization:
223
+ Description: "Prohibits mixing memoization with other statements in the same method."
224
+ Enabled: true
225
+
226
+ Callbacksystems/NoNestedModulesInClasses:
227
+ Description: "Prohibits a module nested inside a class."
228
+ Enabled: true
229
+
230
+ Callbacksystems/NoNilAtEndOfMethod:
231
+ Description: "Prohibits a trailing `nil` at the end of a method."
232
+ Enabled: true
233
+
234
+ Callbacksystems/NoRedundantValidationName:
235
+ Description: "Requires a validation callback to name its condition without repeating `valid` or `validate`."
236
+ Enabled: true
237
+
238
+ Callbacksystems/NoRedundantWrapperMethod:
239
+ Description: "Flags a private method that only forwards to another call."
240
+ Enabled: true
241
+ Safe: false
242
+
243
+ Callbacksystems/NoSectionDividerComments:
244
+ Description: "Prohibits ASCII-art section divider comments."
245
+ Enabled: true
246
+ SafeAutoCorrect: true
247
+
248
+ Callbacksystems/NoSendInTests:
249
+ Description: "Prohibits `send` and `__send__` in tests."
250
+ Enabled: true
251
+ Include:
252
+ - "test/**/*"
253
+
254
+ Callbacksystems/NoServiceObjects:
255
+ Description: "Prohibits service object directories under `app/`."
256
+ Enabled: true
257
+ Include:
258
+ - "app/**/*"
259
+
260
+ Callbacksystems/NoSingleLetterNames:
261
+ Description: "Prohibits single-letter variable, block argument, and parameter names."
262
+ Enabled: true
263
+
264
+ Callbacksystems/NoSingletonClassInModules:
265
+ Description: "Prefers `extend self` over `class << self` in a module."
266
+ Enabled: true
267
+ Safe: false
268
+
269
+ Callbacksystems/NoTapCollectionBuilding:
270
+ Description: "Prohibits building a collection imperatively with `tap`."
271
+ Enabled: true
272
+ Safe: false
273
+
274
+ Callbacksystems/NoTurboStreamInControllers:
275
+ Description: "Keeps Turbo Stream markup out of controllers."
276
+ Enabled: true
277
+ Include:
278
+ - "app/controllers/**/*"
279
+
280
+ Callbacksystems/NoTypographicClutter:
281
+ Description: "Prohibits typographic punctuation and double-hyphen dashes in comments, and invisible characters in comments and strings."
282
+ Enabled: true
283
+ SafeAutoCorrect: false
284
+
285
+ Callbacksystems/NoWritesInGetActions:
286
+ Description: "Keeps GET actions free of writes and enqueued side effects."
287
+ Enabled: true
288
+ Safe: false
289
+ Include:
290
+ - "app/controllers/**/*"
291
+
292
+ Callbacksystems/OrderedMixinArguments:
293
+ Description: "Requires mixin arguments to be sorted alphabetically."
294
+ Enabled: true
295
+ SafeAutoCorrect: false
296
+
297
+ Callbacksystems/PluralControllerNames:
298
+ Description: "Requires controller names to be plural."
299
+ Enabled: true
300
+ IgnoredNames:
301
+ - Application
302
+ - Base
303
+ Include:
304
+ - "app/controllers/**/*"
305
+
306
+ Callbacksystems/PreferAttrReaderOverInstanceVariable:
307
+ Description: "Prefers an `attr_reader` over reading an instance variable assigned in `initialize`."
308
+ Enabled: true
309
+ Safe: false
310
+
311
+ Callbacksystems/PreferBackslashContinuation:
312
+ Description: "Prefers backslash continuation over parentheses for a multiline call that cannot fit on one line."
313
+ Enabled: true
314
+ SafeAutoCorrect: false
315
+
316
+ Callbacksystems/PreferClassForState:
317
+ Description: "Detects a value threaded through many methods that reads better as class state."
318
+ Enabled: true
319
+ Safe: false
320
+ MinMethods: 4
321
+
322
+ Callbacksystems/PreferClassNewForEmptyNestedClass:
323
+ Description: "Prefers a `Class.new` constant over a nested class with no body."
324
+ Enabled: true
325
+ SafeAutoCorrect: false
326
+
327
+ Callbacksystems/PreferClassOverBuilderBlock:
328
+ Description: "Prefers a class over a `Data.define`, `Struct.new`, or `Class.new` given a block."
329
+ Enabled: true
330
+ SafeAutoCorrect: false
331
+
332
+ Callbacksystems/PreferDefaultArgument:
333
+ Description: "Prefers a default in the signature over a fallback assigned at the top of the method."
334
+ Enabled: true
335
+
336
+ Callbacksystems/PreferDelegate:
337
+ Description: "Prefers `delegate` over a method that only forwards to a same-named method."
338
+ Enabled: true
339
+ SafeAutoCorrect: false
340
+
341
+ Callbacksystems/PreferDelegateOverInstanceVariableAssignment:
342
+ Description: "Prefers `delegate` over an `initialize` assignment that mirrors a method call."
343
+ Enabled: true
344
+ Safe: false
345
+
346
+ Callbacksystems/PreferExcluding:
347
+ Description: "Prefers `excluding` for collection subtraction and suggests it for record-ID exclusions."
348
+ Enabled: true
349
+ Safe: false
350
+ SafeAutoCorrect: false
351
+
352
+ Callbacksystems/PreferExtractAssociated:
353
+ Description: "Prefers `extract_associated` over preloading and collecting the same association in a model."
354
+ Enabled: true
355
+ Safe: false
356
+ SafeAutoCorrect: false
357
+ Include:
358
+ - "app/models/**/*.rb"
359
+
360
+ Callbacksystems/PreferItBlockParameter:
361
+ Description: "Prefers `it` over a single named parameter in a single-line block."
362
+ Enabled: true
363
+ SafeAutoCorrect: false
364
+
365
+ Callbacksystems/PreferMany:
366
+ Description: "Prefers `many?` over comparing `size` with one."
367
+ Enabled: true
368
+ Safe: false
369
+ SafeAutoCorrect: false
370
+
371
+ Callbacksystems/PreferMethodOverLambda:
372
+ Description: "Prefers a method over a lambda or proc held in a local that captures nothing from its method."
373
+ Enabled: true
374
+ Safe: false
375
+
376
+ Callbacksystems/PreferMethodOverVariable:
377
+ Description: "Prefers a method over a local variable that repeats the name it calls."
378
+ Enabled: true
379
+ Safe: false
380
+ Exclude:
381
+ - "test/**/*"
382
+
383
+ Callbacksystems/PreferModuleForStaticClass:
384
+ Description: "Prefers a module with `extend self` over a class holding only class-level code."
385
+ Enabled: true
386
+ Safe: false
387
+
388
+ Callbacksystems/PreferOrdinalArrayAccess:
389
+ Description: "Prefers an ordinal method such as `first` over a numeric array index."
390
+ Enabled: true
391
+ Safe: false
392
+ SafeAutoCorrect: false
393
+
394
+ Callbacksystems/PreferPositiveWrap:
395
+ Description: "Prefers wrapping the happy path in `if` over a leading negative guard."
396
+ Enabled: true
397
+ SafeAutoCorrect: true
398
+
399
+ Callbacksystems/PreferSquish:
400
+ Description: "Prefers `squish` over stripping and collapsing whitespace by hand."
401
+ Enabled: true
402
+ Safe: false
403
+ SafeAutoCorrect: false
404
+
405
+ Callbacksystems/PreferStringifyKeys:
406
+ Description: "Prefers `stringify_keys` over `transform_keys(&:to_s)`."
407
+ Enabled: true
408
+ Safe: false
409
+ SafeAutoCorrect: false
410
+
411
+ Callbacksystems/PreferSymbolizeKeys:
412
+ Description: "Prefers `symbolize_keys` over `transform_keys(&:to_sym)`."
413
+ Enabled: true
414
+ Safe: false
415
+ SafeAutoCorrect: false
416
+
417
+ Callbacksystems/PreferTurboPageRefreshBroadcasts:
418
+ Description: "Prefers Turbo page refreshes over targeted stream broadcasts."
419
+ Enabled: true
420
+ Safe: false
421
+ Include:
422
+ - "app/**/*"
423
+
424
+ Callbacksystems/PrivateConstantsInPrivateSection:
425
+ Description: "Requires a constant that serves the implementation to live in the private section."
426
+ Enabled: true
427
+ Safe: false
428
+
429
+ Callbacksystems/PrivateDelegatePlacement:
430
+ Description: "Requires a `delegate ... private: true` to sit in the private section."
431
+ Enabled: true
432
+ SafeAutoCorrect: false
433
+
434
+ Callbacksystems/PrivateMethodsInPrivateSection:
435
+ Description: "Requires a private method to be defined in the private section, not marked afterwards."
436
+ Enabled: true
437
+
438
+ Callbacksystems/PrivateNestedClassMethodVisibility:
439
+ Description: "Requires a method in a nested class placed below `private` to be private when nothing outside calls it."
440
+ Enabled: true
441
+ Safe: false
442
+
443
+ Callbacksystems/PrivateNestedClasses:
444
+ Description: "Requires a nested class to be declared in the private section."
445
+ Enabled: true
446
+
447
+ Callbacksystems/PublicMethodsMustHaveTests:
448
+ Description: "Requires every public method to have a test."
449
+ Enabled: true
450
+ Safe: false
451
+ Include:
452
+ - "app/**/*"
453
+ - "lib/**/*"
454
+ Exclude:
455
+ - "app/controllers/concerns/**/*"
456
+ - "app/helpers/**/*"
457
+
458
+ Callbacksystems/RedundantConcernExtend:
459
+ Description: "Flags an unnecessary `extend ActiveSupport::Concern`."
460
+ Enabled: true
461
+ Safe: false
462
+ SafeAutoCorrect: false
463
+
464
+ Callbacksystems/RedundantConstantFreeze:
465
+ Description: "Flags a `freeze` on a constant assignment."
466
+ Enabled: true
467
+ SafeAutoCorrect: false
468
+
469
+ Callbacksystems/RedundantConstantNamespace:
470
+ Description: "Flags a constant reference that repeats the namespace it is written inside."
471
+ Enabled: true
472
+ Safe: false
473
+ SafeAutoCorrect: false
474
+
475
+ Callbacksystems/ReflowComments:
476
+ Description: "Refills a comment block wrapped short of the maximum line length."
477
+ Enabled: true
478
+ SafeAutoCorrect: true
479
+
480
+ Callbacksystems/RepeatedFixtureInTests:
481
+ Description: "Requires a fixture used by several tests to move to `setup`."
482
+ Enabled: true
483
+ Safe: false
484
+ Include:
485
+ - "test/**/*"
486
+
487
+ Callbacksystems/RestrictedControllerActions:
488
+ Description: "Restricts a controller to the seven standard Rails actions."
489
+ Enabled: true
490
+ Include:
491
+ - "app/controllers/**/*"
492
+
493
+ Callbacksystems/RoutesModuleScope:
494
+ Description: "Requires repeated `module:` options in routes to be extracted to a scope block."
495
+ Enabled: true
496
+ Safe: false
497
+ SafeAutoCorrect: false
498
+ Include:
499
+ - "config/routes.rb"
500
+ - "config/routes/**/*"
501
+
502
+ Callbacksystems/SingleLineSetupBlock:
503
+ Description: "Requires braces for a single-line `setup` or `teardown` block."
504
+ Enabled: true
505
+ SafeAutoCorrect: true
506
+ Include:
507
+ - "test/**/*"
508
+
509
+ Callbacksystems/SingleSingletonClass:
510
+ Description: "Requires class-level methods to live in a single `class << self` section."
511
+ Enabled: true
512
+
513
+ Callbacksystems/SingleTopLevelClassOrModule:
514
+ Description: "Prohibits more than one top-level class or module per file."
515
+ Enabled: true
516
+
517
+ Callbacksystems/SingleUseFixtureVariable:
518
+ Description: "Requires a fixture used once to be inlined."
519
+ Enabled: true
520
+ Safe: false
521
+ SafeAutoCorrect: false
522
+ Include:
523
+ - "test/**/*"
524
+
525
+ Callbacksystems/SingleUseSetupVariable:
526
+ Description: "Requires a setup variable used by at most one test to be inlined."
527
+ Enabled: true
528
+ Safe: false
529
+ SafeAutoCorrect: false
530
+ Include:
531
+ - "test/**/*"
532
+
533
+ Callbacksystems/SingularScopeNames:
534
+ Description: "Requires scope names to be singular unless they use a `with_` prefix."
535
+ Enabled: true
536
+ Include:
537
+ - "app/models/**/*"
538
+
539
+ Callbacksystems/SpaceInsidePercentLiteral:
540
+ Description: "Requires a space inside the delimiters of a percent literal."
541
+ Enabled: true
542
+ SafeAutoCorrect: true
543
+
544
+ Callbacksystems/SystemTestBrowserDriver:
545
+ Description: "Keeps system tests on a real browser driver."
546
+ Enabled: true
547
+ Include:
548
+ - "test/**/*"
549
+
550
+ Callbacksystems/TestMethodDefinition:
551
+ Description: "Requires `test` and block syntax over `def test_*` and setup method definitions."
552
+ Enabled: true
553
+ Include:
554
+ - "test/**/*"
555
+
556
+ Callbacksystems/TestMethodOrder:
557
+ Description: "Requires tests to follow the method order of the file they cover."
558
+ Enabled: true
559
+ SafeAutoCorrect: false
560
+ Include:
561
+ - "test/**/*"
562
+
563
+ Callbacksystems/TooManyInstanceVariables:
564
+ Description: "Limits instance variable assignments in a private method."
565
+ Enabled: true
566
+ MaxAssignments: 2
567
+
568
+ Callbacksystems/TooManyLocalVariables:
569
+ Description: "Limits local variable assignments in a method."
570
+ Enabled: true
571
+ MaxAssignments: 3
572
+
573
+ Callbacksystems/TooManyValidationGuards:
574
+ Description: "Limits the validation guards standing at the start of a method."
575
+ Enabled: true
576
+ MaxGuards: 2
577
+
578
+ Callbacksystems/UnnecessaryLocalVariable:
579
+ Description: "Flags a local variable that aliases a method call already reading as a name."
580
+ Enabled: true
581
+ Safe: false
582
+ SafeAutoCorrect: false
583
+ Exclude:
584
+ - "app/controllers/**/*"
585
+ - "test/**/*"
586
+
587
+ Callbacksystems/UnusedPrivateMethodInNestedClass:
588
+ Description: "Flags an unused private method in a nested class placed below `private`."
589
+ Enabled: true
590
+ Safe: false