如何在 IntelliJ IDEA 中禁用对模块的某些检查? [英] 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?
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":
这篇关于如何在 IntelliJ IDEA 中禁用对模块的某些检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!