Skip to content

Fix 159: check-docstring-first shall ignore attribute docstring at module top level #812

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

Closed
wants to merge 2 commits into from
Closed

Fix 159: check-docstring-first shall ignore attribute docstring at module top level #812

wants to merge 2 commits into from

Conversation

joaoe
Copy link

@joaoe joaoe commented Oct 3, 2022

Now attribute docstrings no longer complain.
https://peps.python.org/pep-0257/#what-is-a-docstring

Fixes #159

@asottile
Copy link
Member

asottile commented Oct 3, 2022

this breaks the point of the tool entirely -- if it isn't something you want to enforce I'd recommend just removing it instead

@asottile asottile closed this Oct 3, 2022
@asottile
Copy link
Member

asottile commented Oct 3, 2022

#159 is closed because this is "unfixable" but for some who do not (ab)use inline docstrings this is still valuable

@joaoe
Copy link
Author

joaoe commented Oct 4, 2022

@asottile

if it isn't something you want to enforce I'd recommend just removing it instead

Well, there is plenty of value of putting docstrings before imports, but the tool could ignore further docstrings further down the file.

How about protecting the behavior with a command line switch ?

for some who do not (ab)use inline docstrings this is still valuable

It is not (ab)use, it is following PEP 257 which this tool violates. And you can see in issue 159 links to bugs where people remove this tools because of this same reason.

@asottile
Copy link
Member

asottile commented Oct 4, 2022

no thanks

domsekotill added a commit to domsekotill/kilter.protocol that referenced this pull request Nov 9, 2023
The hook doesn't support module attribute docstrings and never will
apparently:

pre-commit/pre-commit-hooks#159
pre-commit/pre-commit-hooks#812
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

check-docstring-first false positive on attribute docstrings
2 participants