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!

7 comments
Comment actions Permalink

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
Comment actions Permalink

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

0
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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

3
Comment actions Permalink

Is this implemented now? I'm trying to reformat code that was written without respect maximum line length and it does nothing

0
Comment actions Permalink

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.

0

Please sign in to leave a comment.