sonar如何添加自定义JAVA规则
Posted 沧海一粟,何以久远
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sonar如何添加自定义JAVA规则相关的知识,希望对你有一定的参考价值。
参考:
1、https://segmentfault.com/a/1190000008659108
2、https://docs.sonarqube.org/display/DEV/Adding+Coding+Rules
3、https://docs.sonarqube.org/display/DEV/Adding+Coding+Rules+using+Java
4、https://docs.sonarqube.org/display/PLUG/Writing+Custom+Java+Rules+101
有两种方式可以扩展代码规则:但是Java只支持方式1
1、Writing coding rules using Java via a SonarQube plugin
2、Adding XPath rules directly through the SonarQube web interface
Writing coding rules in Java is a six-step process:
- Create a SonarQube plugin.
- Put a dependency on the API of the language plugin for which you are writing coding rules.
- Create as many custom rules as required
- Generate the SonarQube plugin (jar file)
- Place this jar file in the SONARQUBE_HOME/extensions/plugins directory
- Restart SonarQube server
以上是关于sonar如何添加自定义JAVA规则的主要内容,如果未能解决你的问题,请参考以下文章
sonar自定义规则开发完并加载之后,为啥sonar只显示,扫描的时候扫描不出来