flake8-bugbear icon indicating copy to clipboard operation
flake8-bugbear copied to clipboard

noqa'ing multi-line strings with B950 works differently than with E501

Open mineo opened this issue 5 years ago • 0 comments

(tmp-961236c5487a52a) ↪ flake8 --version                     
3.6.0 (flake8-bugbear: 18.8.0, flake8-docstrings: 1.3.0, pydocstyle: 3.0.0, flake8-print: 3.1.0, flake8-todo: 0.7, mccabe: 0.6.1, naming: 0.7.0, pycodestyle: 2.4.0, pyflakes: 2.0.0) CPython 3.7.2 on Linux
(tmp-961236c5487a52a) ↪ cat testfile.py 
#!/usr/bin/env python
"""
strftime documentation: https://docs.python.org/2/library/datetime.html?highlight=datetime#strftime-strptime-behavior
""" # noqa
(tmp-961236c5487a52a) ↪ flake8 --select=E501,B950 testfile.py
testfile.py:3:118: B950 line too long (117 > 80 characters)

The following version works:

(tmp-961236c5487a52a) ↪ cat testfile.py          
#!/usr/bin/env python
"""
strftime documentation: https://docs.python.org/2/library/datetime.html?highlight=datetime#strftime-strptime-behavior # noqa
"""
(tmp-961236c5487a52a) ↪ flake8 --select=E501,B950 testfile.py
(tmp-961236c5487a52a) ↪

I find placing noqa after the (possibly very long) module docstring easier though, since I can then use as many long links in that block as I want. Also, for the example given, Sphinx 1.8.3 adds the #noqa part to the link :-(

mineo avatar Jan 13 '19 17:01 mineo