AppCode 2020.1 Help

Disable and suppress inspections

Some inspections may report problems that you currently do not want to see. In this case, you can disable or suppress them.

When you disable an inspection, you turn it off. It means that the code analysis engine stops searching project files for the problem that this inspection is designed to detect. Note that when you disable an inspection, you disable it in the current inspection profile; it remains enabled in other profiles.

Disable inspections

Disable an inspection in the settings

  1. In the Preferences dialog ⌘,, select Editor | Inspections.

  2. Locate the inspection you want to disable, and clear the checkbox next to it.

  3. Apply the changes and close the dialog.

You can quickly disable a triggered inspection directly in the editor.

Disable an inspection in the editor

  1. Place the caret at the highlighted string and press ⌥⏎ (or click the Intention action icon to use the intention action).

  2. Click the right arrow icon next to the inspection you want to disable, and select Disable inspection.

Disable an inspection in the Results tool window

  1. In the Inspection Results tool window (after running code analysis), right-click the inspection you want to disable and select Disable inspection.

  2. Click the Filter resolved items icon to hide the disabled inspection alerts.

Re-enable inspections

  1. In the Preferences dialog ⌘,, go to Preferences | Editor | Inspections.

  2. Locate the disabled inspection in the list and select the checkbox next to it.

  3. Click OK to apply the changes.

Suppress inspections

When you suppress an inspection, the code analysis engine doesn't highlight the problem found by this inspection in the specific piece of code (class, method, field, or statement). You can also suppress all inspections in the current class.

Suppress an inspection in the editor

  1. Place the caret at the highlighted string and press ⌥⏎ (or click the Intention action icon to use the intention action).

  2. Click the right arrow icon next to the inspection you want to suppress, and select the necessary suppress action.

    Suppressing an inspection

For Objective-C, AppCode uses the #pragma clang diagnostic code to suppress inspections. For example, when you suppress the Incomplete implementation inspection for a selected method, the following code appears right above the method declaration:

#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wincomplete-implementation"

Suppress an inspection in the Results tool window

  • In the Inspection Results tool window (after running code analysis), right-click the inspection you want to suppress and select the necessary suppress action.

Enable suppressed inspections

When you suppress an inspection, the IDE adds the #pragma annotation before the selected symbol. For example, if you suppress an inspection for a method, AppCode adds the annotation before this method.

  • To re-enable a suppressed inspection, delete the #pragma annotation.

Change the highlighting level for a file

  • By default, AppCode highlights all detected code problems. You can change this behavior for the file you are currently working with. Click the Hector icon in the status bar (bottom right-hand corner), and select one of these options:

    • highlighting is off None: turn highlighting off.

    • highlight syntax Syntax: highlight syntax problems only.

    • highlighting is on Inspections: (default) highlight syntax problems and problems found by inspections.

  • You can also change the highlighting level from the main menu. Select or press ⌥⇧⌘H.

Last modified: 26 June 2020