Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too long lines (E501) fail to be reported when ending with an open triple-quoted string #679

Closed
dawagner opened this issue Aug 31, 2017 · 7 comments

Comments

@dawagner
Copy link

I initialiy reported this issue on flake8 and got redirected here.

Too long lines (E501) fail to be reported when ending open with a triple-quoted string (aka longstring).

Here's an example:

foo.py:

$ cat foo.py 
len("this line if 86 chars long and is not reported.....", "foo bar baz spam egg", """
        some other string""")

len("this line is 86 chars long and is reported.........", """foo bar baz spam egg""",
    "some other string")

$ flake8 foo.py 
foo.py:4:80: E501 line too long (86 > 79 characters)
@bdmbdsm
Copy link

bdmbdsm commented Sep 6, 2017

I will take on this task if you do not mind it

@dawagner
Copy link
Author

dawagner commented Sep 6, 2017

Please do 👍

@bdmbdsm
Copy link

bdmbdsm commented Sep 7, 2017

Sorry, I became short on time - must concentrate on my new project. I will not work on this issue.

@r3m0t
Copy link

r3m0t commented Dec 3, 2017

It's fixed already.

commit cb17d2739696df66c5b1eed2de559b4d778836e2
Author: Anthony Sottile <asottile@umich.edu>
Date:   Wed Mar 15 08:37:40 2017 -0700

    Correctly report E501 when the first line of a docstring is too long
    
    Resolves #622

@sigmavirus24
Copy link
Member

Thanks for noticing that @r3m0t

@manu2504
Copy link

Hello - the issue still persists with pycodestyle v2.8.0.

You may reproduce it with following snippet:

no_flake8_e501_error = "My line longer than 80 chars xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + '''
'''

flake8_e501_error = "My line longer than 80 chars xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Running flake8 on this file results with:

e501.py:4:81: E501 line too long (103 > 80 characters)

Here are my flake8 installed plugins:

$ poetry run flake8 --bug-report 
{
  "dependencies": [],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.9.6",
    "system": "Darwin"
  },
  "plugins": [
    {
      "is_local": false,
      "plugin": "mccabe",
      "version": "0.6.1"
    },
    {
      "is_local": false,
      "plugin": "pycodestyle",
      "version": "2.8.0"
    },
    {
      "is_local": false,
      "plugin": "pyflakes",
      "version": "2.4.0"
    }
  ],
  "version": "4.0.1"
}

@r3m0t

@asottile
Copy link
Member

this seems to be flake8 specific, I'll open an issue there: PyCQA/flake8#1534

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants