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

查看:453
本文介绍了如何禁用IntelliJ IDEA中模块的某些检查?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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?

推荐答案

你需要定义自定义范围配置检查的范围


  1. Go到设置 - >外观和行为 - >范围并创建一个新范围。递归包含所有文件,然后排除给定的项目库。

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

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

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