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

拜拜、爱过 提交于 2019-12-01 19:41:09

问题


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?


回答1:


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 symbol. In the scope settings, choose your newly defined scope.



来源:https://stackoverflow.com/questions/28692654/how-do-i-disable-some-inspections-for-modules-in-intellij-idea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!