问题描述
在我们的团队中,由于多种原因,特别是由于仪表板,我们已经从使用Checkstyle和FindBugs切换到SonarQube,因为它们使我们能够更轻松地全局了解我们的位置。
In my team, we have switched from using Checkstyle and FindBugs to SonarQube, for many reasons, and particularly because of the dashboards, as they make it easier to have a global view of where we stand.
但是,在此过程中,我们丢失了一些有用的支票,这些支票我正在尝试使用SonarQube进行转换/重新实现。特别是,我们的Java代码(旧版和较新版本)受到以下日志记录平台/库的困扰:slf4j + logback,Commons Logging,Java Util Logging等。
However, in the process, we have lost a few useful checks that I am trying to convert / reimplement with SonarQube. In particular, our Java code (legacy and newer) is plagued by a use of several logging platforms/libraries: slf4j+logback, Commons Logging, Java Util Logging, etc.
我在Checkstyle中使用Regexp的用例是定义一个规则,以便仅允许记录的导入基于slf4j。
My use case for the Regexp in Checkstyle is to define a rule so that the only imports allowed for logging are based on slf4j.
SonarQube维护了一个提供实现的页面样式的状态,我在中看到了正则表达式
SonarQube maintains a page that gives the implementation status of Checkstyle rules and I see Regexp in the list of rejected rules.
是否有一种实现Regexp规则的方法,或者仅仅是用例而已?我无法找到拒绝每条被拒绝规则的解释,以查看是否有建议。
Is there a means to implement the Regexp rule or is it just a use case that will not be? I haven't been able to find an explanation of the rejection of each of the rejected rules, to see if there were recommendations.
推荐答案
考虑到您的用例,我认为您可以使用Disallowed类规则模板:来跟踪使用不当记录器的位置。
Given your usecase I think you can make use of Disallowed class rule template : https://jira.sonarsource.com/browse/RSPEC-3688 to track where the improper loggers are used.
这篇关于如何在SonarQube中实现Checkstyle Regexp规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!