Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable some inspections for modules in IntelliJ IDEA?

In IntelliJ IDEA, I can disable some inspections for a class, method, or other units. I have a module in a project that's a library that I am not the only consumer of. I do not use all the methods in the library and consequently a large number are marked 'unused'. These are all false positives. I would like to disable these inspections for this module alone (ideally, I'd like to disable unused warnings for public/protected methods).

Is this possible? If so, how would one go about doing this?

like image 724
Roshan Avatar asked Feb 24 '15 09:02

Roshan


1 Answers

You need to define a custom scope and configure the inspections' scope.

  1. Go to Settings -> Appearance & Behavior -> Scope and create a new scope. Include recursively all files, then exclude the given project library.

  2. Then go to Settings -> Editor -> Inspections and choose the inspections you want to disable for that project library, e.g. Declaration redundancy -> Unused declaration. In the severity settings (on the right side under "Description") choose your newly defined scope.

Per default the severity settings look like this (if the settings apply for all scopes):

Inspection - Severity settings

How it looks if the inspection is disabled for a scope named "Library Modules":

Inspection - Severity settings - Inspection disabled for scope "Library Modules"

like image 148
sina72 Avatar answered Oct 15 '22 03:10

sina72