Comments (7)
Sorry, I don't get it. ๐
Do you mean that:
- There's a false positive. Violation is shown, but it should not
- There's a false negative. Violation is not shown, but it should be
?
from flake8-broken-line.
Sorry.
A violation was shown, but i dont believe it should be.
The \
there is not used to create a line break, its used to change how the '''
string shows up (it prevents an initial newline from being rendered into the string)
from flake8-broken-line.
I believe the same would happen with
"""\
"""
from flake8-broken-line.
Sorry, but I cannot reproduce this problem.
(.venv) ~/Documents/github/returns master โ 1 โ ๏ธ
ยป cat ex1.py
'''\
'''
(.venv) ~/Documents/github/returns master โ
ยป flake8 ex1.py
ex1.py
1:1 Q002 Remove bad quotes from docstring
'''\
'''
^
Full list of violations and explanations:
https://wemake-python-stylegui.de/en/0.14.0/pages/usage/violations/
ยป flake8 --version
3.8.2 (flake8-bandit: 2.1.2, flake8-broken-line: 0.2.0, flake8-bugbear:
19.8.0, flake8-comprehensions: 3.2.2, flake8-darglint: 1.4.0, flake8-debugger:
3.2.1, flake8-docstrings: 1.5.0, pydocstyle: 5.0.2, flake8-eradicate: 0.3.0,
flake8-pyi: 20.5.0, flake8-pytest-style: 1.1.1, flake8-string-format: 0.2.3,
flake8_commas: 2.0.0, flake8_isort: 2.9.1, flake8_quotes: 2.1.2, mccabe:
0.6.1, naming: 0.9.1, nitpick: 0.22.2, pycodestyle: 2.6.0, pyflakes: 2.2.0,
rst-docstrings: 0.0.12, wemake_python_styleguide: 0.14.0) CPython 3.7.7 on
Darwin
from flake8-broken-line.
My minimal repro
% flake8 --version (assets-3.6)
3.8.2 (flake-mutable: 1.2.0, flake8-broken-line: 0.2.0, flake8-bugbear:
20.1.4, flake8-colors: 0.1.0, flake8-comprehensions: 3.2.2, flake8-eradicate:
0.3.0, flake8_commas: 2.0.0, flake8_isort: 3.0.0, flake8_quotes: 3.2.0,
flake8_strict: 0.2.1, mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes: 2.2.0, use-
fstring-format: 1.0, use-fstring-percent: 1.0) CPython 3.6.3 on Linux
% cat file.py (assets-3.6)
def fn():
return """\
"""
% flake8 file.py (assets-3.6)
file.py:2:1: N400: Found backslash that is used for line breaking
1
And with both quote styles
% cat file.py (assets-3.6)
def fn():
return """\
"""
def fn2():
return '''\
'''
% flake8 --extend-ignore Q001,Q002,Q003 file.py (assets-3.6)
file.py:2:1: N400: Found backslash that is used for line breaking
file.py:6:1: N400: Found backslash that is used for line breaking
2
And just to clarify what the '''\
and """\
are for
% python3 (assets-3.6)
Python 3.6.3 (default, Oct 3 2017, 21:45:48)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> '''
... aa
... aa
... '''
'\naa\naa\n'
>>> '''\
... aa
... aa
... '''
'aa\naa\n'
See that the one with the \
eliminates the leading newline
Thanks
from flake8-broken-line.
Yes, this makes a difference:
2:1 N400: Found backslash that is used for line breaking
return """\
"""
^
from flake8-broken-line.
Sorry for the unclear initial bug report!
from flake8-broken-line.
Related Issues (20)
- Broken line in triple quotes HOT 4
- What does "do not reimplement chaining" mean? HOT 3
- Support python3.8
- Dependabot can't resolve your Python dependency files
- Dependabot can't resolve your Python dependency files
- Dependabot can't resolve your Python dependency files
- Fix the CI and update deps HOT 4
- Typo: "Found backslash that is used for line breaking" HOT 2
- How to chain methods without arguments? HOT 1
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- Add python3.9 support
- PEP8 backslash exception for `with` statements is not honored HOT 1
- Support for flake8 4.x HOT 2
- [N400] How to short imports? HOT 3
- Please release new version HOT 8
- Compat with flake8 >= 6 HOT 8
- Backslashes in rf strings not honored as in r strings.
- Backslash at end of comment incorrectly detected
- False-positive for backslashes in multiline strings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake8-broken-line.