如何配置 jenkinsfile 以使用声纳分析 python 代码
How to configure jenkinsfile to analyze python code with sonar
我写了类似的东西但没有用。
stage('SonarQube Analysis')
{
withSonarQubeEnv('sonar')
{
sh "python hello_world.py sonar:sonar"
}
}
}
您可以使用 SonarPython 来实现。
按照 official documentation 如何配置 SonarPython 并对您的 Python 项目执行静态代码分析。
如SonarPython documentation you need to run sonar-scanner
, documentation about using sonar-scanner
with Jenkins
is here: Analyzing with SonarQube Scanner for Jenkins
中所述
例如:
stage('SonarQube analysis') {
// requires SonarQube Scanner 2.8+
def scannerHome = tool 'SonarQube Scanner 2.8';
withSonarQubeEnv('My SonarQube Server') {
sh "${scannerHome}/bin/sonar-scanner"
}
}
我写了类似的东西但没有用。
stage('SonarQube Analysis')
{
withSonarQubeEnv('sonar')
{
sh "python hello_world.py sonar:sonar"
}
}
}
您可以使用 SonarPython 来实现。
按照 official documentation 如何配置 SonarPython 并对您的 Python 项目执行静态代码分析。
如SonarPython documentation you need to run sonar-scanner
, documentation about using sonar-scanner
with Jenkins
is here: Analyzing with SonarQube Scanner for Jenkins
例如:
stage('SonarQube analysis') {
// requires SonarQube Scanner 2.8+
def scannerHome = tool 'SonarQube Scanner 2.8';
withSonarQubeEnv('My SonarQube Server') {
sh "${scannerHome}/bin/sonar-scanner"
}
}