SonarQube-代码检测工具安装
简介
SonarQube是一个代码质量和安全分析工具,支持java、python、go、c等30+种语言。
SonarQube is a self-managed, automatic code review tool that systematically helps you deliver clean code. As a core element of our Sonar solution, SonarQube integrates into your existing workflow and detects issues in your code to help you perform continuous code inspections of your projects. The tool analyses 30+ different programming languages and integrates into your CI pipeline and DevOps platform to ensure that your code meets high-quality standards.
安装配置
下载链接:
https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.9.1.69595.zip
安装文档:
https://docs.sonarqube.org/latest/try-out-sonarqube/
需要java17支持,先安装java17
1 | ## 下载安装包 |
启动和登录
1 |
|
启动后登录,默认密码admin/admin
新建gitlab-porject
选择分析的方式
目前支持jenkins/gitlab-ci等,这里采用最简单的本地分析
本地运行分析
1 | ## 在代码下载到本地,并运行此命令即可(这里用的mvn的java项目) |
返回页面查看结果
页面可以看到项目的疑似bug,安全漏洞等,点击可以定位到具体代码
后续
配置使用外部数据库(略)
配置持续集成工具jenkins或gitlab-ci(略)