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.

B018 wrongly detects inline variable or attribute docstrings

See original GitHub issue

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.
"""

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
cooperleescommented, Nov 29, 2021

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.

3reactions
Mischbackcommented, Nov 29, 2021

Wow, that was fast!

@cooperlees @kasium Thx a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to document a module constant in Python? - Stack Overflow
Unfortunately, variables (and constants) do not have docstrings. ... the ``Attributes`` section of the module docstring, or in an inline ...
Read more >
PEP 8 – Style Guide for Python Code
Documentation Strings​​ Write docstrings for all public modules, functions, classes, and methods. Docstrings are not necessary for non-public ...
Read more >
LLVM Language Reference Manual
Abstract¶. This document is a reference manual for the LLVM assembly language. LLVM is a Static Single Assignment (SSA) based representation that provides ......
Read more >
example_google — Solutions 0.0.1 documentation
Attributes : module_level_variable1 (int): Module level variables may be documented in ... or in an inline docstring immediately following the variable.
Read more >
Python Docstrings Tutorial : Examples & Format for Pydoc ...
Python documentation string or commonly known as docstring, is a string ... Docstrings are accessible from the doc attribute (__doc__) for any of...
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