question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WPS324 false-positive with docstring

See original GitHub issue

Bug report

What’s wrong

This code produces false positive WPS324 due to docstring line.

from botx import Collector

collector = Collector()


@collector.default(include_in_status=False)
def default_handler() -> None:
    """This is the problem line."""

    return None

How is that should be

Docstring should not cause false positives.

System information

flake8 information

Contents of flake8 --bug-report:

Details { "dependencies": [ { "dependency": "entrypoints", "version": "0.3" } ], "platform": { "python_implementation": "CPython", "python_version": "3.8.2", "system": "Linux" }, "plugins": [ { "is_local": false, "plugin": "flake8-bandit", "version": "2.1.2" }, { "is_local": false, "plugin": "flake8-broken-line", "version": "0.2.0" }, { "is_local": false, "plugin": "flake8-bugbear", "version": "19.8.0" }, { "is_local": false, "plugin": "flake8-comprehensions", "version": "3.2.2" }, { "is_local": false, "plugin": "flake8-darglint", "version": "0.4.1" }, { "is_local": false, "plugin": "flake8-debugger", "version": "3.2.1" }, { "is_local": false, "plugin": "flake8-docstrings", "version": "1.5.0, pydocstyle: 5.0.2" }, { "is_local": false, "plugin": "flake8-eradicate", "version": "0.3.0" }, { "is_local": false, "plugin": "flake8-string-format", "version": "0.2.3" }, { "is_local": false, "plugin": "flake8_commas", "version": "2.0.0" }, { "is_local": false, "plugin": "flake8_isort", "version": "2.9.1" }, { "is_local": false, "plugin": "flake8_quotes", "version": "2.1.2" }, { "is_local": false, "plugin": "mccabe", "version": "0.6.1" }, { "is_local": false, "plugin": "naming", "version": "0.9.1" }, { "is_local": false, "plugin": "pycodestyle", "version": "2.5.0" }, { "is_local": false, "plugin": "pyflakes", "version": "2.1.1" }, { "is_local": false, "plugin": "rst-docstrings", "version": "0.0.12" }, { "is_local": false, "plugin": "wemake_python_styleguide", "version": "0.14.0" } ], "version": "3.7.9" }

pip information

Contents of pip freeze:

Details astor==0.8.1 attrs==19.3.0 bandit==1.6.2 botx==0.14.0 certifi==2020.4.5.1 chardet==3.0.4 darglint==1.2.3 docutils==0.16 entrypoints==0.3 eradicate==1.0 flake8==3.7.9 flake8-bandit==2.1.2 flake8-broken-line==0.2.0 flake8-bugbear==19.8.0 flake8-commas==2.0.0 flake8-comprehensions==3.2.2 flake8-debugger==3.2.1 flake8-docstrings==1.5.0 flake8-eradicate==0.3.0 flake8-isort==2.9.1 flake8-polyfill==1.0.2 flake8-quotes==2.1.2 flake8-rst-docstrings==0.0.12 flake8-string-format==0.2.3 gitdb==4.0.4 GitPython==3.1.1 h11==0.9.0 h2==3.2.0 hpack==3.0.0 hstspreload==2020.4.24 httpx==0.11.1 hyperframe==5.2.0 idna==2.9 isort==4.3.21 loguru==0.4.1 mccabe==0.6.1 pbr==5.4.5 pep8-naming==0.9.1 pycodestyle==2.5.0 pydantic==1.5.1 pydocstyle==5.0.2 pyflakes==2.1.1 Pygments==2.6.1 PyYAML==5.3.1 restructuredtext-lint==1.3.0 rfc3986==1.4.0 six==1.14.0 smmap==3.0.2 sniffio==1.1.0 snowballstemmer==2.0.0 stevedore==1.32.0 testfixtures==6.14.1 toml==0.10.0 typing-extensions==3.7.4.2 urllib3==1.25.9 wemake-python-styleguide==0.14.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sobolevncommented, Apr 25, 2020

@nsidnev that’s a really good question. I think that there are no reason for a function to just return None

Why would someone need this function? (Even in functional programming world)

So, I guess that it might be a feature instead. We can add a test that explicitly covers this case: one function, one docstring, one return (with None and plain one), one violation.

Also, there is a test that such code is bad. And this code isn’t. Is that right?

This question is more like “why would anyone want to do this?” Probably we can make both these cases invalid.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Loose punctuation mark" false-positive in Python docstring
"Loose punctuation mark" false-positive in Python docstring. 70. Relates to 1 Is duplicated by 4 ... IDEA-303541 "Unpaired symbol is missing" false positive....
Read more >
wemake-python-styleguide - Issuehunt
WPS324 false-positive with docstring. Unfunded#1361created bySlyfoxy. $0.00. Add `__await__` to the list of priority magic methods.
Read more >
pandas docstring guide — pandas 1.5.2 documentation
A Python docstring is a string used to document a Python module, class, function or method, so programmers can understand what it does...
Read more >
Introduction to docstring
2017-03-24. The docstring package is a package for R that provides the ability to display something analagous to Python's docstrings within R.
Read more >
Python Docstrings Tutorial : Examples & Format for Pydoc ...
See Python Docstrings. Learn about the different types of docstrings & various docstring formats like Sphinx, Numpy, and Pydoc with examples now.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found