Git Product home page Git Product logo

Comments (7)

DRMacIver avatar DRMacIver commented on May 6, 2024

Confirmed in master.

from yapf.

bwendling avatar bwendling commented on May 6, 2024

Interesting. Our version of pylint doesn't agree with PEP 8 on this. If I move the ) to align with the f in foo, it complains that it shouldn't be that way.

from yapf.

alexjurkiewicz avatar alexjurkiewicz commented on May 6, 2024

I think you're aware (not sure if you're talking pep8 the linter or pep8 the spec), but it seems pylint and pep8 the linter don't agree. Here's another example of yapf output:

TEST_LIST = ('foo', 'bar',  # first comment
             'baz',  # second comment
            )

This raises pep8 linter E124 "closing bracket does not match visual indentation". If I add another space to the last line, you instead get pylint C0330 "wrong continued indentation"!

The pep8 spec says the following: "The closing brace/bracket/parenthesis on multi-line constructs may either line up under the first non-whitespace character of the last line of list [example1] or it may be lined up under the first character of the line that starts the multi-line construct [example2]".

example1 shows this:

my_list = [
    1, 2, 3,
    4, 5, 6,
    ]

example2 (not relevant to this discussion really, just included for completeness):

my_list = [
    1, 2, 3,
    4, 5, 6,
]

It seems pylint & yapf are wrong, in this case. The pep8 linter error is correct.

from yapf.

alexjurkiewicz avatar alexjurkiewicz commented on May 6, 2024

I think the test testClosingBracketIndent in reformatter_test.py is wrong, it claims this is correct layout:

while (xxxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa' and
       xxxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == 'bbbbbbb'
      ):

from yapf.

bwendling avatar bwendling commented on May 6, 2024

@alexjurkiewicz It seems like this is a conflict between Google's version and PEP 8. I'll need to add a knob to control this...

from yapf.

bwendling avatar bwendling commented on May 6, 2024

I added 9439278. Let's see if that fixes this for you.

from yapf.

alexjurkiewicz avatar alexjurkiewicz commented on May 6, 2024

Beaut! Thanks @gwelymernans 👍

from yapf.

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.