flake8-bugbear: B018 wrongly detects inline variable or attribute docstrings
Having an inline attribute doc string or a module variable docstring, it is wrongly marked as B018 (sample from sphinx doc):
module_level_variable2 = 98765
"""int: Module level variable documented inline.
The docstring may span multiple lines. The type may optionally be specified
on the first line, separated by a colon.
"""
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 16 (7 by maintainers)
Commits related to this issue
- Mitigate bug in flake8-bugbear Release 21.11.28 of flake8-bugbear introduces a bug with B018 (see https://github.com/PyCQA/flake8-bugbear/issues/208). As of now, simply disable that rule in flake8 c... — committed to Mischback/django-calingen by Mischback 3 years ago
- fix: failing qa because latest version to flake8-bugbear see https://github.com/PyCQA/flake8-bugbear/issues/208 — committed to jnoortheen/xonsh by jnoortheen 3 years ago
- adopt NEP-0029 (#4568) * chore: adopt NEP-0029 for py version deprecation policy fixes #4560 * chore: drop py3.6 from CI * docs: add news item * fix: failing qa because latest version to ... — committed to xonsh/xonsh by jnoortheen 3 years ago
- Reapply flake8-bugbear settings Wow, that was quick! https://github.com/PyCQA/flake8-bugbear/issues/208 already fixed! — committed to Mischback/django-calingen by Mischback 3 years ago
- [tests] ignore bugbear 21.11.28 https://github.com/PyCQA/flake8-bugbear/issues/208 Change-Id: Ifc3854032ea6f6144e22830dfaf4a4d83f564d4a — committed to wikimedia/pywikibot by xqt 3 years ago
21.11.29 released reverting checking of strings for now. We will work on adding some pattern matching support into the string detection and probably default to ignoring this edge use case.
I also, 21.11.28 yanked from PyPI so it can not be installed to create noise.
Wow, that was fast!
@cooperlees @kasium Thx a lot!
My fault. The ignore was only for strings and not for f-strings (aka JoinedStr). PR is open
For info, attribute docstrings aren’t a Python feature, however, are widely used and supported by the Sphinx documentation system via autodoc.