IntelliJ IDEA allows you to create custom inspections based on search templates. The inspection list provides a Structural Search Inspection, which is a powerful tool for creating search templates. Based on this inspection, you can create any number of search templates to inspect your source code and any number of replace templates to be used as means to resolve detected problems.
Using the Structural Search Inspection is the only way to create custom inspections through the IntelliJ IDEA interface. Alternatively, you can develop an external plugin to implement a custom inspection.
- Open the Inspections dialog box.
- Select the desired profile from the drop-down list. The inspections associated with the selected profile are displayed in the tree view.
- In the list of inspections, expand the General node and select the check box next to the Structural Search Inspection item. This enables the controls in the Options area, where you can configure a custom inspection.
- Click the Add Search Template button. In the Structural Search dialog box that opens specify the search options.
- Click the Add Replace Template button. In the Structural Replace dialog box that opens specify the replace options.
- Complete the lsit of inspection templates:
- To edit a template, select it in the Selected Templates list, click the Edit button, and edit the template in the Edit Template dialog box that opens.
- To remove a template, select it in the list and click the Remove button.
- Specify the inspection severity using the Severity drop-down list.
Associate the inspection with a
If an inspection is not associated with a scope, it applies to all the sources of the current project.