If you think that some inspections report about the problems that you are note interested in, you can disable such inspections. Note that when you disable an inspection, it is disabled in the current inspection profile; in all other profiles, it remains enabled.
There are several ways to disable/enable inspections:
- Using the Inspections settings settings page - this is the main interface for managing inspections; here you can see at once, which inspections are enabled or disabled in all inspection profiles.
- Using the intention actions - this is the way to disable a highlighted code issues right in the editor.
- In the Inspection tool window - this is a quick way to disable uninteresting issues when analyzing inspection results. Note that here you can only disable inspections.
Note the difference between disabling and suppressing code inspections: By 'suppressing' an inspection, PyCharm inserts a special comments that tell the code analysis engine to ignore the issues found by the inspection in a specific piece of code. By 'disabling' an inspection, you just turn it off so the code analysis engine stops ignores all code issues.
- In the inspection settings, select the desired profile. The inspections associated with the profile are displayed in the tree view.
To find the desired inspection, expand the grouping nodes or use the search field.
- Note that inspections, whose state is changed relative to the default values, and all their grouping nodes are highlighted with blue.
- Use the check box next to the inspection to disable or enable it.
- Apply the changes and close the dialog box.
- Set the caret at a highlighted issue.
- Click the bulb icon or press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1 to reveal the inspection alert and suggestion list.
- Select the inspection to be disabled, then click right arrow button or just press the right arrow key.
- On the submenu, click .
- In the Inspection tool window, right-click the inspection you want to disable.
- On the context menu, choose Disable inspection.
- Press the filter button to hide the disabled inspection alerts.