New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow __init__ to not have a docstring #273

Closed
mitar opened this Issue Jul 30, 2017 · 10 comments

Comments

Projects
5 participants
@mitar
Copy link

mitar commented Jul 30, 2017

I prefer to have docstring for init as part of the class docstring. Currently it seems there is no way to disable just the requirement for the init docstring.

@sigmavirus24

This comment has been minimized.

Copy link
Member

sigmavirus24 commented Jul 31, 2017

__init__ should be considered a "magic" method and thus should be reported as D105. You can ignore D105 altogether to get rid of that.

@mitar

This comment has been minimized.

Copy link

mitar commented Jul 31, 2017

Currently it is ignored as a magic method. But yes, as a workaround I patched VARIADIC_MAGIC_METHODS to not contain __init__.

But because it seems there are different ways people would like this, maybe for __init__ there could be a configuration.

@Nurdok

This comment has been minimized.

Copy link
Member

Nurdok commented Jul 31, 2017

I think this is common enough to merit a dedicated D1xx error code.

@AndreiPashkin

This comment has been minimized.

Copy link

AndreiPashkin commented Sep 2, 2017

Numpy docstring guide specifically says:

The constructor (__init__) should also be documented here [in a class docstring]...

@Nurdok

This comment has been minimized.

Copy link
Member

Nurdok commented Sep 2, 2017

@AndrewPashkin This is already merged :)

@AndreiPashkin

This comment has been minimized.

Copy link

AndreiPashkin commented Sep 2, 2017

@Nurdok, the merge request just created a dedicated error code for that. But Numpy rules state that __init__ SHOULD be documented in the class docstring and so it's not an error for __init__ to not have a docstring.

@mitar

This comment has been minimized.

Copy link

mitar commented Sep 2, 2017

Yes, so people who are using Numpy rules can configure pydocstyle to ignore that dedicated error. I think requiring D101 also requires one to document constructor in class docstring, no?

@AndreiPashkin

This comment has been minimized.

Copy link

AndreiPashkin commented Sep 2, 2017

But in Numpy rules it's not an error at all.

@Nurdok Nurdok added this to Done in Pydocstyle 2.1.1 Sep 2, 2017

@Nurdok

This comment has been minimized.

Copy link
Member

Nurdok commented Sep 2, 2017

Seems to me that if this is the case, it's a simple matter of removing D107 from being on by default in the numpy convention.

@Alexis-B

This comment has been minimized.

Copy link

Alexis-B commented Oct 4, 2017

Hi, this feature seems to be a good thing. Are there plans to publish a new pydocstyle version?
A great improvement would be to ignore missing docstring for __init__ only when it takes no parameter.

shacharoo added a commit to shacharoo/pydocstyle that referenced this issue Oct 5, 2017

shacharoo added a commit to shacharoo/pydocstyle that referenced this issue Oct 5, 2017

Nurdok added a commit that referenced this issue Oct 8, 2017

Merge pull request #288 from FarmerSez/remove-D107-from-numpy
#273 - Removing D107 from numpy default violations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment