在Sonar中,如何防止检查某些包中的某些规则? [英] In Sonar, how to prevent checking some rules in some packages?

查看:308
本文介绍了在Sonar中,如何防止检查某些包中的某些规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个共同部分的Android / Blackberry项目。显然,这部分是为了编译到Android和Blackberry目标而编写的,因此,不能使用一些较新的Java特性(例如,Integer.valueOf)。我想跳过一些专门针对该部分的规则。有没有办法做到这一点?

We have an Android/Blackberry project with a common part. That part, obviously, is written to compile to both Android and Blackberry targets, and, consequently, cannot use some of the newer Java features (e.g., Integer.valueOf). I'd like to skip some of the rules specifically for that part. Is there a way to do this?

推荐答案

如果将公共部分分离到自己的项目,可以添加新的质量要求并将其分配给您的公共项目。

If you separate the common part to an own project you can add a new Quality Profile in Sonar (where you deactivated these rules) and assign it to your common project.

除此之外,你可以使用

// NOSONAR

评论在一行上发出警告

这篇关于在Sonar中,如何防止检查某些包中的某些规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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