reformat code to specified line length
Answered
hi all..
Our coding standard specifies line lengths no greater than 79 characters. I've specified this in the File:Settings:Code Style:Python:Right Margin with global settings selected. I then tried Code:Reformat Code but it didn't change the line lengths. Is there some way to do this?
thanks!
Please sign in to leave a comment.
Hello David,
A lot of formatter improvements, including checking that right margin is
not exceeded, is planned for 1.5 version.
I still have the same issue on pycharm 2017 is that fixed?
Hi Nikolaos! Could you please provide a code sample to reproduce the problem? Please feel free to create a ticket in our bug tracker directly https://youtrack.jetbrains.com/issues/PY
Actually, I had to activate the: Ensure right margin is not exceeded option on Wrapping and Braces tab in Editor>Code Style > Python.
It was confusing because Reformat Code was wrapping at 80 characters even if I had it at the Hard wrap at 79.
Guys, this is not implemented for Ruby, is it? I have Editor > Code Style, Hard wrap at set to 80. Yet when I use ctrl + alt + shift + L to reformat the whole file, it uses 120 columns.
I see that Editor > Code Style > Ruby has no "Ensure right margin is not exceeded".
Is this implemented now? I'm trying to reformat code that was written without respect maximum line length and it does nothing
Arnold Roa
It should work for python. If you have issues with exceeding right margin, please provide code sample and screenshot of your code style settings.