You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
W: Lint/NestedMethodDefinition: Method definitions must not be nested. Use lambda instead.
def page(number) ...
^^^^^^^^^^^^^^^^^
Expected behavior
The cop should ignore extending method block.
If this is considered too specific to Rails, the cop should provide a configuration option to ignore given methods.
…int/NestedMethodDefinition`
Fixesrubocop#11018 and rubocop#8860.
This PR adds `AllowedMethods` and `AllowedPatterns` for `Lint/NestedMethodDefinition`.
For example, `has_many`, `extending`, and other Rails APIs can be specified in RuboCop Rails config.
`class_eval`, `instance_eval`, `module_eval`, `class_exec`, `instance_exec`, and
`module_exec` leave hard-coded for core methods.
…tedMethodDefinition`
Fixes#11018 and #8860.
This PR adds `AllowedMethods` and `AllowedPatterns` for `Lint/NestedMethodDefinition`.
For example, `has_many`, `extending`, and other Rails APIs can be specified in RuboCop Rails config.
`class_eval`, `instance_eval`, `module_eval`, `class_exec`, `instance_exec`, and
`module_exec` leave hard-coded for core methods.
Rails is providing
extending
method to add methods to an ActiveRecord relation :https://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-extending
It'll be flagged with the following offense:
Expected behavior
The cop should ignore
extending
method block.If this is considered too specific to Rails, the cop should provide a configuration option to ignore given methods.
RuboCop version
The text was updated successfully, but these errors were encountered: