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!

5 comments

Hello David,

A lot of formatter improvements, including checking that right margin is

not exceeded, is planned for 1.5 version.

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!

---

Original message URL:

http://devnet.jetbrains.net/message/5299407#5299407

0

I still have the same issue on pycharm 2017 is that fixed?

0

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

0

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.

0

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".

1

Please sign in to leave a comment.