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
Is your feature request related to a problem? Please describe.
While the style guide prefers duck typing over inheritance, many developers prefer inheritance for the sake of communicating structure to other developers. If a method both has arguments and raises a NotImplementedError – a common pattern for defining method signatures – the Lint/UnusedMethodArgument warning is triggered.
Describe the solution you'd like
I would like functions with arguments that only contain raise NotImplementedError to be ignored by Lint/UnusedMethodArgument. Ideally, there would be a setting (maybe IgnoreNotImplementedMethods) that is true by default.
This should not trigger any warnings
class Example
def process_thing(thing)
raise NotImplementedError
end
end
Describe alternatives you've considered
Currently you can use the following work arounds
Leave a method empty, because IgnoreEmptyMethods is true by default
This is insufficient, because in many cases calling a method should immediately fail if it hasn't been implemented by a child class. Otherwise, bugs can appear far deeper in the execution path.
Prefix the variables with an underscore
This is insufficient, as it communicates that the prefixed argument(s) are optional. They may not be.
Don't include arguments in the signature
This is insufficient, as it fails to communicate the arguments child classes should expect for a method.
The text was updated successfully, but these errors were encountered:
deiden26
changed the title
Allow unused variables when funciton only raises a NotImplementedError
Allow unused variables when a class method only raises a NotImplementedError
Feb 21, 2020
Is your feature request related to a problem? Please describe.
While the style guide prefers duck typing over inheritance, many developers prefer inheritance for the sake of communicating structure to other developers. If a method both has arguments and raises a
NotImplementedError
– a common pattern for defining method signatures – theLint/UnusedMethodArgument
warning is triggered.Describe the solution you'd like
I would like functions with arguments that only contain
raise NotImplementedError
to be ignored byLint/UnusedMethodArgument
. Ideally, there would be a setting (maybeIgnoreNotImplementedMethods
) that is true by default.This should not trigger any warnings
Describe alternatives you've considered
Currently you can use the following work arounds
Leave a method empty, because
IgnoreEmptyMethods
is true by defaultThis is insufficient, because in many cases calling a method should immediately fail if it hasn't been implemented by a child class. Otherwise, bugs can appear far deeper in the execution path.
Prefix the variables with an underscore
This is insufficient, as it communicates that the prefixed argument(s) are optional. They may not be.
Don't include arguments in the signature
This is insufficient, as it fails to communicate the arguments child classes should expect for a method.
The text was updated successfully, but these errors were encountered: