如何在 IntelliJ IDEA 中禁用对模块的某些检查? [英] How do I disable some inspections for modules in IntelliJ IDEA?

查看:23
本文介绍了如何在 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.

  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):

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

这篇关于如何在 IntelliJ IDEA 中禁用对模块的某些检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆