Skip to content
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

flake8 the docstrings? #13813

Closed
nstarman opened this issue Oct 8, 2022 · 5 comments
Closed

flake8 the docstrings? #13813

nstarman opened this issue Oct 8, 2022 · 5 comments

Comments

@nstarman
Copy link
Member

nstarman commented Oct 8, 2022

Description

Examples in the docstrings should be well formatted.
We can add flake8-docstrings to flake8's dependencies in pre-commit to enforce this.

Additional context

See https://flake8.pycqa.org/en/latest/user/using-hooks.html#usage-with-the-pre-commit-git-hooks-framework.
There are other flake8 extensions we might enjoy.

@namurphy
Copy link
Contributor

namurphy commented Nov 3, 2022

I've had good experiences with using flake8-rst-docstrings too.

Adding flake8 extensions has been one of my favorite strategies for Procrastination Driven Development (PDD).

@namurphy
Copy link
Contributor

A related possibility would be to add an autoformatter for docstrings (and even reStructuredText files). At the moment, I haven't found a reStructuredText/numpydoc autoformatter that I'm happy enough with to add to pre-commit or CI. I'll probably post what I learn in the future in in PlasmaPy/PlasmaPy#1668 and PlasmaPy/PlasmaPy#1669.

Also worth mentioning is pydocstyle.

@nstarman
Copy link
Member Author

Ruff implements a lot of pydocstyle, so this would be very easy (to add, not to fix all the docstrings)
https://github.com/charliermarsh/ruff#pydocstyle-d

@namurphy
Copy link
Contributor

A Python linter written in Rust? I'll have to check it out. That's way better than my idea for a Python linter written in Fortran!

@nstarman
Copy link
Member Author

Ruff is implementing much of this functionality so we can close this issue.

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

No branches or pull requests

3 participants