参考:
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
时间: 2024-11-10 07:17:49