yapf (facebook style) loves to make a two-step reformat of over-long line
See original GitHub issueYAPF loves to make two steps if run twice in fixing this:
# last character is column 87 with our indent
self.assertEqual(result.reason_not_added, "current preflight is still running")
becomes
self.assertEqual(result.reason_not_added,
"current preflight is still running")
next run it becomes
self.assertEqual(
result.reason_not_added, "current preflight is still running"
)
Now, I like the last option best, and it’s what we want, but the fact we take consistently two steps to get there is a surprise. I’m not sure why it prefers the intermediate form once, but it happens often enough to feel “routine”.
Issue Analytics
- State:
- Created 8 years ago
- Comments:15 (13 by maintainers)
Top Results From Across the Web
A brand new website interface for an even better experience!
yapf (facebook style) loves to make a two-step reformat of over-long line.
Read more >How to use yapf (or black) in VSCode - Stack Overflow
According to the YAPF documentation: YAPF will search for the formatting style in the following manner: Specified on the command line >> VS...
Read more >Software Engineering at Google
arguments for adopting best practices like testing, knowledge sharing, and ... and do a line-by-line “readability review” of their first major code commit....
Read more >Auto formatters for Python
You can see that yapf (Facebook) and black are trying to convert the code to multi-line brackets while the rest do not do...
Read more >Software Engineering at Google - DOKUMEN.PUB
How an organization makes decisions, based on the lessons of Time and Change ... A book like this would not be possible without...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This problem is inherent to YAPF’s rules that depend on the “current relative line location”. After a single reformatting that relative location might change, in which case it will have different penalties assigned. I haven’t got time to really work on this before, you’re probably have to wait until PyCon for me to get to this during sprints.
I confirm that it now works correctly for both my code and the example supplied by @daniel-pittman.
Please release to pypi.