GoLand 2023.2 Help

Create custom inspections

To create a custom inspection, you have to configure a search and replace templates. The IDE will search for code that matches the template and will highlight it in the editor.

  1. In the Settings dialog (Control+Alt+S), go to Editor | Inspections.

    You can also press Control+Alt+Shift+H and select Configure Inspections.

  2. Select the profile in which you want to create a new inspection.

  3. On the toolbar, click the Add Custom Inspection button (the Add Custom Inspection button) and select Add RegExp Search Inspection… if you want your inspection only to highlight code. Alternatively, click Add RegExp Replace Inspection… if you want your inspection to highlight code strings and suggest fixes.

    Adding a new Structural Search and Replace inspection
  4. When finished, click OK.

  5. In the Custom RegExp Inspection dialog, type a name of the new inspection, specify a tooltip, description, and provide a suppress ID if necessary.

  6. Apply the changes and close the dialog.

After that, your custom inspection is going to appear in the list of inspections. There, you can change its severity and the scope in which this inspection will run.

Custom inspection shown in the list of inspections

When your inspection is ready, you can run it. Alternatively, if the inspection is enabled, pieces of code will be highlighted automatically.

Running custom inspection
Last modified: 15 August 2023