IntelliJ IDEA 2017.3 Help

Applying Quickfixes Automatically


When you run an inspection against your code, the Inspection Results Tool Window is displayed showing the results of code analysis. You can then examine the issues that have been detected and apply the suggested quickfixes.

However, you may want to streamline this process by automatically applying the quickfixes from your inspection profile to the selected scope, without having to examine the results and implement each separate fix individually.

Applying quickfixes automatically

To apply quickfixes automatically

  1. From the main menu, select Analyze | Code Cleanup.
  2. In the Specify Code Cleanup Scope dialog that opens, select ths scope to which you want the inspection profile to be applied.
  3. Select the inspection profile from the drop-down list, or click the browseButton button to configure a new profile in the Inspections dialog that opens. You can also click the browseButton button to check which fixes will be applied.
  4. Click OK to launch the inspection.

IntelliJ IDEA will perform code analysis and will automatically apply quickfixes from the selected inspection profile to all issues that are detected.

Alternatively, you can place the caret at an error in the source code that corresponds to a quickfix, click the red bulb (quick-fix suggested) icon quickfixBulb that appears on the left, and select Code Cleanup from the drop-down menu. Code cleanup will be performed for the current file with the current inspection profile.

Applying quickfixes on commit to VCS

To apply quickfixes when committing changes to a VCS

  1. From the main menu, select VCS | Commit Changes.
  2. In the Commit Changes dialog that opens, select the files that you want to commit, and select the Cleanup code option in the Before Submit area.

Code cleanup will be performed for all selected files before they are committed to your version control system (the current project inspection profile will be applied).

Last modified: 6 March 2018

See Also