Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Automatic inheritance of docstrings #274

Open
mitar opened this issue Jul 31, 2017 · 3 comments
Open

Automatic inheritance of docstrings #274

mitar opened this issue Jul 31, 2017 · 3 comments

Comments

@mitar
Copy link

mitar commented Jul 31, 2017

I am using custom_inherit package to automatically inherit docstrings. It would be great if pydocstyle could somehow detect that and not issue a D102 error on such methods.

I think this could be done by some simple heuristic and configuration:

  • allowing to specify a list of decorators, which if they are applied to a method make D102 not be made
  • allow to list name of a base class/metaclass used, and if it is used, D102 is not made

This might be simpler than #185 and would require only a basic check without really do dynamic analysis of the code.

@sigmavirus24
Copy link
Member

allowing to specify a list of decorators, which if they are applied to a method make D102 not be made

Isn't that --ignore-decorators ?

allow to list name of a base class/metaclass used, and if it is used, D102 is not made

I or Amir would have to check to see how metaclasses are represented in the AST on Py 2 and Py 3. If they're easily and statically accessible this would be a sensible addition along the lines of --ignore-decorators.

@Nurdok
Copy link
Member

Nurdok commented Jul 31, 2017

@sigmavirus24 is right about the decorator flag.

Also, (and without checking), I think it should probably be pretty easy to get both parent classes and metaclasses.

@clintval
Copy link

clintval commented Dec 2, 2018

I would be interested in this as well since many of my classes use DocInheritMeta as a metaclass.

I accidentally opened an issue in flake8-docstrings making this same request!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants