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

max line length not enforced for long first line docstrings #622

Closed
jleverenz opened this issue Feb 2, 2017 · 3 comments
Closed

max line length not enforced for long first line docstrings #622

jleverenz opened this issue Feb 2, 2017 · 3 comments

Comments

@jleverenz
Copy link

jleverenz commented Feb 2, 2017

Somewhat new to python tooling and pycodestyle, but I believe this should trigger the (default) max line length E501:

def foo():
    """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pulvinar vitae

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    """

The first docstring line is 83 characters (> 79). I believe pycodestyle may be looking at the tokenized docstring, which doesn't include the leading whitespace in front of the opening """ in the physical line.

@asottile
Copy link
Member

asottile commented Mar 15, 2017

Interesting, while attempting to write a test for this it fails to reproduce when added to testsuite/E50.py, in order to trigger a failure I needed to make a new file testsuite/E501.py -- I suspect something is wonky with the test suite.

EDIT: and now it is mysteriously working, on to fixing the bug I guess

@asottile
Copy link
Member

Interesting.

def test():
    """fooooooooooooooooooooooooooooooooooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
    bar
    """

triggers E501

but

def test():
    """foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
    bar
    """

does not

@asottile
Copy link
Member

Oh that's the special case for "urls", I'll proceed with the testcase in the ticket

openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Apr 4, 2024
* Update cinder from branch 'master'
  to b0f0b9015b9dfa228dff98eeee5116d8eca1c3cc
  - Merge "hacking: Fix E501 errors"
  - hacking: Fix E501 errors
    
    PyCQA/pycodestyle#622 was fixed
    in pycodestyle 2.4.0, which triggers E501 for docstrings
    that didn't previously.
    
    This shows up if we pull in a hacking>=6.0.0.
    
    Change-Id: Id3c8a66c26f01ca734e6bc33c14f5deedf8e15f3
openstack-mirroring pushed a commit to openstack/cinder that referenced this issue Apr 4, 2024
PyCQA/pycodestyle#622 was fixed
in pycodestyle 2.4.0, which triggers E501 for docstrings
that didn't previously.

This shows up if we pull in a hacking>=6.0.0.

Change-Id: Id3c8a66c26f01ca734e6bc33c14f5deedf8e15f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants