Apply "Reformat file" only to one line (or inspection issue)

Completed
My problem is the following:

I recently switched to pyCharm. When I open a file with a lot of code I get many underlined code snippets (inspection issues). Some of them are justified like "a= b +c" should be "a = b + c". Others I want to keep as they are like "a = b**2 + c**2", say for personal taste reasons.

pyCharm offers the possibilty to solve such inspection issues automatically. Thats great. However, it performs its rules to the whole file and thereby changes also the "issues" I want to keep. I would like to trigger the issue-auto-solver only for the current issue, keeping me in control of what is changed an what not. Jumping to the next issue (of the same type) without using the mouse would also be very helpful.

Is that possible? Could I configure pyCharm to make it possible?

(I know I could also change the rules and then apply them to the whole file but it seems to be tricky to teach pyCharm my coding taste. Also, I prefer to keep control over the source.)
1 comment
Comment actions Permalink

Even though this is an old thread - if someone is still struggling try:

  1. Select the fragment you'd like to change
  2. Main Menu -> Code -> Reformat Code    (CTRL+ALT+L usually)

Also, consider up-voting this suggestion if you don't think that pre-selecting the line you want to fix is not the best approach. Maybe you would find it reasonable.

-------------------------

PS

Just for completeness:

> Jumping to the next issue (of the same type) without using the mouse would also be very helpful.

  1. Main Menu -> Code -> Inspect Code
  2. Main Menu -> Navigate -> Go Next Problem (CTRL + ALT + DOWN usually)

 

 

 

0

Please sign in to leave a comment.