Giter Site home page Giter Site logo

Comments (7)

sobolevn avatar sobolevn commented on May 30, 2024

Sorry, I don't get it. ๐Ÿ™‚

Do you mean that:

  1. There's a false positive. Violation is shown, but it should not
  2. There's a false negative. Violation is not shown, but it should be

?

from flake8-broken-line.

merc1031 avatar merc1031 commented on May 30, 2024

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.

merc1031 avatar merc1031 commented on May 30, 2024

I believe the same would happen with

"""\
"""

from flake8-broken-line.

sobolevn avatar sobolevn commented on May 30, 2024

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.

merc1031 avatar merc1031 commented on May 30, 2024

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.

sobolevn avatar sobolevn commented on May 30, 2024

Yes, this makes a difference:

  2:1      N400: Found backslash that is used for line breaking
  return """\
    """
  ^

from flake8-broken-line.

merc1031 avatar merc1031 commented on May 30, 2024

Sorry for the unclear initial bug report!

from flake8-broken-line.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.