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?
You need to define a custom scope and configure the inspections' scope.
Go to Settings -> Appearance & Behavior -> Scope
and create a new scope. Include recursively all files, then exclude the given project library.
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):
How it looks if the inspection is disabled for a scope named "Library Modules":
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With