I bet you’ll agree with me that dealing with legacy code is not a pleasant task. Almost like cleaning up an old storage room full of dust and garbage. Even if you have powerful inspections that tell you what’s going wrong, you still have to run them manually and then apply quick-fixes one by one on every of the errors you have found. We don’t like mundane tasks like that, and that’s why in the new IntelliJ IDEA 14 EAP build we’re adding the new Code Cleanup feature that automatically fixes your code for you, in one click instead of dozen.
To use the feature, simply go to Analyse → Code Cleanup… menu. You’ll get a simple dialog where you specify the scope of project files that you want analyzed and fixed, and the inspection profile to use for that.
You can change the list of used inspections by clicking the button next to the inspection profile selector.
When you come across an corresponding issue in the editor, IntelliJ IDEA offers you to run the Code Cleanup over the entire file right from there.
And, of course, you will be prompted to clean your code up before committing changes to a VCS.
Develop with Pleasure!