YAPF breaks noqa for multiline strings in brackets
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
It is possible to make a file with a ` # noqa` comment which disables a `flake8` error, which YAPF will move so that the comment is no longer useful.
Install dependencies:
```console
$ pip install yapf flake8
$ pip freeze
flake8==3.5.0
mccabe==0.6.1
pycodestyle==2.3.1
pyflakes==1.6.0
yapf==0.20.1
```
Create `example.py` with the following contents:
```python
foo = (
"""\
Short
Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long
Short
""" # noqa: E501
)
```
There is no `flake8` error because the `E501` error is ignored:
```console
$ flake8 example.py
$
```
Run YAPF, this changes the file:
```console
$ yapf --in-place example.py
$ cat example.py
foo = (
"""\
Short
Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long
Short
"""
# noqa: E501
)
```
`flake8` now does not ignore the error:
```console
$ flake8 example.py
example.py:4:80: E501 line too long (88 > 79 characters)
```
Contributor guide
Assessment
This issue has not been assessed yet.