I did see the discussion on #60 and #480, and as far as I can tell there is not any way to selectively control a subset of magic methods that flag D105. This is something I would be interested in, since __str__/__repr__ are effectively boilerplate, but other magic methods might be more nuanced.
I could see this going a few different ways if this is accepted, and any other suggestions are welcome as well!
Ignore Categories of Magic
Less configurable, but it could lead to more concise, intention-oriented, configuration.
Referring to the data model, I could see common-case reductions of the space of ~90 magic methods in the data model to just ~15 "categories".
I did see the discussion on #60 and #480, and as far as I can tell there is not any way to selectively control a subset of magic methods that flag D105. This is something I would be interested in, since
__str__
/__repr__
are effectively boilerplate, but other magic methods might be more nuanced.I could see this going a few different ways if this is accepted, and any other suggestions are welcome as well!
Ignore Categories of Magic
Less configurable, but it could lead to more concise, intention-oriented, configuration.
Referring to the data model, I could see common-case reductions of the space of ~90 magic methods in the data model to just ~15 "categories".
__bool__
__bytes__
__del__
https://docs.python.org/3/reference/datamodel.html#customizing-class-creation
https://docs.python.org/3/reference/datamodel.html#customizing-instance-and-subclass-checks
https://docs.python.org/3/reference/datamodel.html#asynchronous-iterators
https://docs.python.org/3/reference/datamodel.html#asynchronous-context-managers
__equals__
__hash__
__format__
__str__
__repr__
From parser.py at least
__init__
,__new__
, and__call__
relate to a different lint, and are not considered here1.__init_subclass__(cls, /, **kwargs)
is a variadic method that is not currently covered in the list, new in version 3.6. May file a PR for this.Ignore Magic By Name
Ignores missing docstrings project-wide based on the method name. Fairly configurable, but could be verbose.
Both ignore rules could be in effect simultaneously, since the names do not overlap.
Bonus: By Path
With either approach, an additional consideration could be made for matching parent paths to allow for more granular control.
This is just an RFC for now. If a consensus is reached, then we can find a volunteer (maybe myself)! Thanks!