无法从SonarQube for iOS应用程序运行Swift插件

hgc7kmma  于 2023-01-10  发布在  iOS
关注(0)|答案(1)|浏览(198)

这是我第一次尝试在我的本地系统上的iOS测试项目中集成SonarQube。我已经下载并成功安装了SonarQube和SonarScanner。我还从here下载了最新的(0.4.6)胶木Sonar Swift插件。
以下是我的声纳扫描仪文件内容:

sonar.host.url=http://localhost:9000
sonar.login=admin
sonar.password=Vivy@123

sonar.projectKey=testSonar1
sonar.projectName=testSonar

# Number version (can be found automatically in plist, just comment this line)
sonar.projectVersion=1.0
# Comment if you have a project with mixed ObjC / Swift
sonar.language=swift
# Project description
sonar.projectDescription=Project Description
# Path to source directories
sonar.sources=.
# Path to test directories (comment if no test)
sonar.tests=testSonarTests,testSonarUITests
sonar.test.inclusions=**/*Test*/**
sonar.test.inclusions=*.swift
sonar.exclusions=**/*.xml,Pods/**/*,Reports/**/*

# Destination Simulator to run surefire
# As string expected in destination argument of xcodebuild command
# Example = sonar.swift.simulator=platform=iOS Simulator,name=iPhone 6,OS=9.2
sonar.swift.simulator=platform=iOS Simulator,name=iPhone 8,OS=latest
# Xcode project configuration (.xcodeproj)
# and use the later to specify which project(s) to include in the analysis (comma separated list)
# Specify either xcodeproj or xcodeproj + xcworkspace
sonar.swift.project=testSonar.xcodeproj
#sonar.swift.workspace=testSonar.xcworkspace
# Specify your appname.
# This will be something like "myApp"
# Use when basename is different from targeted scheme.
# Or when slather fails with 'No product binary found'
sonar.swift.appName=testSonar
# Scheme to build your application
sonar.swift.appScheme=testSonar
# Configuration to use for your scheme. if you do not specify that the default will be Debug
sonar.swift.appConfiguration=Debug
##########################
# Optional configuration #
##########################
# Encoding of the source code
sonar.sourceEncoding=UTF-8
# SCM
# sonar.scm.enabled=true
# sonar.scm.url=scm:git:http://xxx
# JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml
# Change it only if you generate the file on your own
# The XML files have to be prefixed by TEST- otherwise they are not processed
sonar.junit.reportsPath=sonar-reports/
# Lizard report generated by run-sonar.sh is stored in sonar-reports/lizard-report.xml
# Change it only if you generate the file on your own
sonar.swift.lizard.report=sonar-reports/lizard-report.xml
# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage-swift.xml
# Change it only if you generate the file on your own
sonar.swift.coverage.reportPattern=sonar-reports/cobertura.xml
# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml
# Change it only if you generate the file on your own
sonar.swift.swiftlint.report=sonar-reports/swiftlint.txt
# Change it only if you generate the file on your own
#sonar.swift.tailor.report=sonar-reports/*tailor.txt
# Paths to exclude from coverage report (surefire, 3rd party libraries etc.)
sonar.swift.excludedPathsFromCoverage=build,DerivedData,fastlane,Pods,reports,testSonarTests,testSonarUITests,xcov_output
sonar.swift.excludedPathsFromCoverage=.*Tests.*
##########################
# Tailor configuration #
##########################
# Tailor configuration
# -l,--max-line-length=<0-999>                  maximum Line length (in characters)
#    --list-files                               display Swift source files to be analyzed
#    --max-class-length=<0-999>                 maximum Class length (in lines)
#    --max-closure-length=<0-999>               maximum Closure length (in lines)
#    --max-file-length=<0-999>                  maximum File length (in lines)
#    --max-function-length=<0-999>              maximum Function length (in lines)
#    --max-name-length=<0-999>                  maximum Identifier name length (in characters)
#    --max-severity=<error|warning (default)>   maximum severity
#    --max-struct-length=<0-999>                maximum Struct length (in lines)
#    --min-name-length=<1-999>                  minimum Identifier name length (in characters)
sonar.swift.tailor.config=--no-color --max-line-length=100 --max-file-length=500 --max-name-length=40 --max-name-length=40 --min-name-length=4

当我执行声纳扫描仪时,我收到执行成功消息。但当我转到声纳控制台时,我收到与一些html或python文件相关的错误。我没有收到任何与Swift相关的错误。请查看下面的屏幕截图:第一节第一节第一节第一节第一节第二节第一节
我觉得Sonar插件没有Map到SonarQube。另外,我可以看到SonarFiles生成如下:

有人能帮我修好它让我的SonarQube运行吗

c90pui9n

c90pui9n1#

脚本很好。除了安装上面提到的sonarqube,我还安装了另一个版本的自制程序。所以当我试图运行Sonar时,我实际上运行的是来自brew的sonar,而不是上面的那个。来自brew的Sonar不包含任何插件,所以我无法扫描我的Swift代码。

相关问题