Linux command
sonar-scanner 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run analysis
sonar-scanner
With project key
sonar-scanner -Dsonar.projectKey=[myproject]
Specify server
sonar-scanner -Dsonar.host.url=[http://localhost:9000]
With authentication token
sonar-scanner -Dsonar.token=[token]
Set source directory
sonar-scanner -Dsonar.sources=[src]
Debug mode
sonar-scanner -X
Specify config file
sonar-scanner -Dproject.settings=[sonar-project.properties]
说明
sonar-scanner performs static analysis for SonarQube/SonarCloud. It scans code for bugs, vulnerabilities, and code smells. Configuration via properties or file. sonar-project.properties defines project. Analysis results upload to server. Web interface shows findings. Multiple languages supported. Java, JavaScript, Python, and many others. CI integration automates scanning. Run on every build or pull request.
参数
- -D _PROPERTY=VALUE_
- Set property.
- -X, --debug
- Debug output.
- -h, --help
- Show help.
- -v, --version
- Show version.
FAQ
What is the sonar-scanner command used for?
sonar-scanner performs static analysis for SonarQube/SonarCloud. It scans code for bugs, vulnerabilities, and code smells. Configuration via properties or file. sonar-project.properties defines project. Analysis results upload to server. Web interface shows findings. Multiple languages supported. Java, JavaScript, Python, and many others. CI integration automates scanning. Run on every build or pull request.
How do I run a basic sonar-scanner example?
Run `sonar-scanner` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -D _PROPERTY=VALUE_ do in sonar-scanner?
Set property.