-
-
Notifications
You must be signed in to change notification settings - Fork 8
Add numpydoc section name checker #248
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
Add numpydoc section name checker #248
Conversation
Could you add a test for this? That helps reviewing what you want the desired behaviour to be! |
.gitignore
Outdated
@@ -4,3 +4,4 @@ dist/ | |||
docs/_build | |||
|
|||
.coverage | |||
*.pyc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this from the .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with doing that, but this means there will be a ton of *.pyc files that have to be ignored. For example:
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
Untracked files:
(use "git add <file>..." to include in what will be committed)
pydocstringformatter/__pycache__/
pydocstringformatter/_configuration/__pycache__/
pydocstringformatter/_formatting/__pycache__/
pydocstringformatter/_utils/__pycache__/
no changes added to commit (use "git add" and/or "git commit -a")
We might also consider ignoring __pycache__
as in:
https://github.com/pandas-dev/pandas/blob/fb754d71db2897b40dd603e880a15e028f64f750/.gitignore#L72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you opposed to ignoring __pycache__
in ~/.gitignore
? In general I don't ever see the need to commit those files to git
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you opposed to ignoring
__pycache__
in~/.gitignore
? In general I don't ever see the need to commit those files togit
.
I never considered adding in a a global git ignore, and it seems that others do it as well (as in this SO answer). However, I can't assume that every user will have these files ignored.
Either way, I'll respect your wishes.
This comment has been minimized.
This comment has been minimized.
for more information, see https://pre-commit.ci
According to the primer, this change has no effect on the checked open source code. 🤖🎉 |
This is failing due to the additional argument: I can't reason why this file name needs to include the names of all the arguments. The other failure is because I'm now raising an error and not continuing the autoformatter. If you would prefer to writing to stderr instead, let me know. Otherwise, we'll need a different way of dealing with this in the test (perhaps a try/except). However, I would prefer to follow the "pattern". |
Yeah, this makes no sense. Would you mind changing this? Perhaps by adding a UUID or global counter to make sure file names don't clash.
I think writing to stderr would be better? Combined with setting an exit code? Would that fix your original issue? Sorry for taking so long to respond. Life got busy suddenly! |
Follow up in #278 |
Simple PR to add a section name checker.
This won't auto-format, but instead will outright fail. In our documentation builder in
pyvista
, it would be helpful to have this fail on pre-commit rather during the documentation build.Also adds in a section to raise an error and indicate which file and docstring caused the error. This made it much easier to debug invalid documentation strings from our documentation.