Skip to content

flake8-docstring does not detect docstrings written in a non-Google style #60

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
nbro10 opened this issue Aug 10, 2023 · 3 comments
Closed

Comments

@nbro10
Copy link

nbro10 commented Aug 10, 2023

We're using the Google's docstring style in our project. I've installed this package in order to make sure that my docstrings are consistent across my project's files. However, it seems that it is not able to detect that one of the modules is not using the Google's docstring style.

Here are my dependencies

...
mccabe                        0.6.1      McCabe checker, plugin for flake8
...
flake8                        3.9.0      the modular source code checker: pep8 pyflakes and co
flake8-docstrings             1.7.0      Extension for flake8 which uses pydocstyle to check docstrings
...
pydocstyle                    6.3.0      Python docstring style checker
pyflakes                      2.3.1      passive checker of Python programs

Let me know if you need more dependencies. I'm using Python 3.8.13.

I'm running flake8 as follows (but you can probably ignore poetry - just in case, I'm using poetry 1.4.0)

poetry run flake8 myfile.py

or (it does not matter - same result)

poetry run flake8 myfile.py --docstring-convention google

Here are my flake8 configs in the tox.ini

[flake8]
max-line-length = 100
max-complexity = 12
docstring-convention = google
max-doc-length = 100
ignore=D100,D101,D102,D103,D104,D105,D107,D200,D202,D205,D212,D415,E203,W503

So, for completeness, in myfile.py I have a function like this (which does not use Google's docstring style)

def my_func(a):
    """
    Do something.

    :param a: Nice.
    :return: Whatever.
    """

So, does this tool actually detect these issues, or did I misinterpret the purpose of this tool?

The README says that pydocstyle 4.0.0 added support for the Google's style, so I'd expect this to be detected, given my dependencies

@sigmavirus24
Copy link
Member

This tool doesn't implement the checks but instead plugs pydocstyle into flake8. Pydocstyle is a separate project

@nbro10
Copy link
Author

nbro10 commented Aug 10, 2023

@sigmavirus24 Ok, thanks, but can you be more specific, given that I suppose you're familiar with pydocstyle? Does pydocstyle implement this check? The problem could even be in this package that doesn't correctly use pydocstyle. Without more info, it's unclear to me. So, maybe, this issue shouldn't be closed immediately. Possibly related: PyCQA/pydocstyle#514

@sigmavirus24
Copy link
Member

I'm fairly certain choosing a convention doesn't forbid another.

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

No branches or pull requests

2 participants