1. Summary
I don't find, how I can automatically wrap long lines in py
files. It would be nice, if someone tell me any command line or Sublime Text tool.
At the time I need to wrap long lines manually.
2. Argumentation
PEP8 E501 rule. Even if I set max line length, for example, to 120, some lines exceed the limit.
3. Requirements
- Windows 10 64-bit Enterprise LTSB EN,
- Python 3.6.3,
- Sublime Text, Build 3143.
4. Example
My SashaIsTheWorld.py
file:
amazing = True
spectacular = True
excellent = True
breathtaking = True
exciting = True
fantastic = True
unmatched = True
magnificent = True
breakneck = True
fascinating = True
if amazing and spectacular and excellent and breathtaking and exciting and fantastic and unmatched and magnificent and breakneck and fascinating is True:
print("It about Sasha")
else:
print("She's the one for me, She's my ecstasy, She's the one I need. She's one in a million, She's once in a lifetime, She made me discover one of the stars above us.")
D:\SashaPythonista>flake8 SashaIsTheWorld.py
SashaIsTheWorld.py:12:121: E501 line too long (153 > 120 characters)
SashaIsTheWorld.py:15:121: E501 line too long (177 > 120 characters)
5. Expected behavior
For example:
amazing = True
spectacular = True
excellent = True
breathtaking = True
exciting = True
fantastic = True
unmatched = True
magnificent = True
breakneck = True
fascinating = True
if amazing and spectacular and excellent and breathtaking and exciting and fantastic \
and unmatched and magnificent and breakneck and fascinating is True:
print("It about Sasha")
else:
print("She's the one for me, She's my ecstasy, She's the one I need. "
"She's one in a million, She's once in a lifetime, She made me discover one of the stars above us.")
6. Not helped
- Google search,
- For Python:
- For Sublime Text:
- AutoWrap not have “smart” wrapping. This package not add
\
symbol and additional quotes. - Daniel Beck plugin also haven't “smart” wrapping.
- Sublime-Wrap-Plus works only for triple quoted strings.
- WrapStatement not works for cases in my example.
- AutoWrap not have “smart” wrapping. This package not add
7. Do not offer
Please, don't tell, that:
- I should not have long lines in the code,
- I need to wrap all long lines manually,
- I need to use ruler. Yes, I use it.