IntelliJ IDEA 2017.3 Help

Creating Custom Inspections

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.

To create a custom inspection

  1. Open the Inspections dialog box.
  2. Select the desired profile from the drop-down list. The inspections associated with the selected profile are displayed in the tree view.
  3. In the list of inspections, expand the General node and select the checkbox next to the Structural Search Inspection item. This enables the controls in the Options area, where you can configure a custom inspection.
  4. Click the Add Search Template button. In the Structural Search dialog box that opens specify the search options.
  5. Click the Add Replace Template button. In the Structural Replace dialog box that opens specify the replace options.
  6. Complete the list 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.
  7. Specify the inspection severity using the Severity drop-down list.
  8. Associate the inspection with a scope.

    If an inspection is not associated with a scope, it applies to all the sources of the current project.

Last modified: 6 March 2018

See Also