gpt4 book ai didi

ios - 无法使脚本 'run-sonar-swift' 工作

转载 作者:搜寻专家 更新时间:2023-10-31 08:28:40 26 4
gpt4 key购买 nike

我正在尝试快速运行 Sonar 。我已经有了带插件的 sonarQube,我可以使用这个 url 在本地访问它 http://localhost:9000 .我已经安装了您可以在这里找到的所有先决条件:

https://github.com/Backelite/sonar-swift

但是当我启动 run-sonar-swift.sh 时,我不知道这个错误是什么。

如果有人能给我带来光明,我将不胜感激。

这是我在终端命令 ./run-sonar-swift.sh -v 中运行时的日志:

MacBook-Air:streamus-phoenix-ios oboujaouane$ ./run-sonar-swift.sh -v

Running run-sonar-swift.sh...

Project count is [1]

Xcode project file is: Streamus.xcodeproj

Xcode workspace file is: Streamus.xcworkspace

Xcode application scheme is: Streamus Alpha

Destination simulator is: platform=iOS Simulator,name=iPhone 6,OS=11.3

Excluded paths from coverage are: .Tests.

Creating directory sonar-reports/

Running tests + xcodebuild clean build test -workspace Streamus.xcworkspace -scheme 'Streamus Alpha' -configuration Debug -enableCodeCoverage YES -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.3' -destination-timeout 60

2018-05-12 10:34:14.031 xcodebuild[32149:775290] IDETestOperationsObserverDebug: Writing diagnostic log for test session to: /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log

2018-05-12 10:34:14.032 xcodebuild[32149:769805] [MT] IDETestOperationsObserverDebug: (98FB295E-FE60-46AA-8589-015B0DD2E617) Beginning test session StreamusUITests-98FB295E-FE60-46AA-8589-015B0DD2E617 at 2018-05-12 10:34:14.031 with Xcode 9E145 on target { SimDevice: iPhone 6 (672DE879-E48B-45DA-BFD9-D0412F51A706, iOS 11.3, Booted) } (11.3 (15E217))

2018-05-12 10:34:14.061 xcodebuild[32149:769805] [MT] IDETestOperationsObserverDebug: (458F86F6-1492-40F1-9F72-A88FC23BD985) Beginning test session StreamusTests-458F86F6-1492-40F1-9F72-A88FC23BD985 at

2018-05-12 10:34:14.061 with Xcode 9E145 on target { SimDevice: iPhone 6 (672DE879-E48B-45DA-BFD9-D0412F51A706, iOS 11.3, Booted) } (11.3 (15E217))

2018-05-12 10:34:14.061 xcodebuild[32149:770075] IDETestOperationsObserverDebug: Writing diagnostic log for test session to: /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log 2018-05-12 10:34:30.016 xcodebuild[32149:769805]

Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log"

UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log}

2018-05-12 10:34:30.016 xcodebuild[32149:769805] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log}

Testing failed: Linker command failed with exit code 1 (use -v to see invocation) ** TEST FAILED **

The following build commands failed:

Ld /Users/oboujaouane/Library/Developer/Xcode/DerivedData/Streamus-gwtdwpbaxrfgafdtejzjtpxyhhhq/Build/Intermediates.noindex/Streamus.build/Alpha-iphonesimulator/StreamusTests.build/Objects-normal/x86_64/StreamusTests normal x86_64

Ld /Users/oboujaouane/Library/Developer/Xcode/DerivedData/Streamus-gwtdwpbaxrfgafdtejzjtpxyhhhq/Build/Intermediates.noindex/Streamus.build/Alpha-iphonesimulator/StreamusTests.build/Objects-normal/i386/StreamusTests normal i386

(2 failures)

  • returnValue=65

  • set +x

ERROR - Command 'xcodebuild clean build test -workspace Streamus.xcworkspace -scheme Streamus Alpha -configuration Debug -enableCodeCoverage YES -destination platform=iOS Simulator,name=iPhone 6,OS=11.3 -destination-timeout 60' failed with error code: 65

提前谢谢你,

最佳答案

  1. 看来错误是由于配置文件引起的。当我添加我的配置文件并再次尝试时,问题就解决了。

  2. 然后我在使用 MessageKit 时遇到了另一个问题:“Segmentation fault: 11”这是 CocoaPods Podfile 配置问题。因此,我必须通过在 Xcode 项目导航器中单击 Pods,然后在 Pod 的目标中选择 MessageKit,然后在 Builds 设置选项卡中,然后在搜索器中点击“编译模式”并切换“Single”,将 Debug 的编译模式从“单个文件”切换到“整个模块”文件”到“整个模块”并重新运行脚本 run-sonar-swift.sh

Here how to switch to Whole Module instead of Single File

⚠️ 每次你进行 pod 安装/更新或可以更改 pod 的东西时,你必须将调试的编译模式从“单个文件”切换到 pod 的“整个模块”,这会在你启动运行时给你一个错误- sonar.swift.sh 带有 -v 表示详细。

  1. 在那之后我的问题还没有结束!事实上,我遇到了最后一个问题,它是 SwipeCellKit pod 的错误:“没有这样的模块 SwipeCellKit”。要解决此问题,请按照此处给出的说明进行操作 https://stackoverflow.com/a/37732248/6188918

  2. 然后我再次尝试并开始执行脚本的其余部分(SwiftLint、Tailor 和 Lizard),我认为这次终于可以了,但是再次发生错误,脚本末尾有一条新的错误消息涉及蜥蜴是:

ERROR: Error during SonarQube Scanner execution

ERROR: File MyprojectName/Domains/Repositories/Local/cacheManager.swift can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

为了解决这个包含/排除问题,我遵循了此处给出的答案: https://stackoverflow.com/a/40150551/6188918通过将这些添加到 sonar.swift.excludedPathsFromCoverage 行下方的 sonar-project.properties 文件中的行:

sonar.test.inclusions=**/*Test*/**

sonar.exclusions=**/*Test*/**

我再次尝试,但使用了参数 -notailor(运行脚本并跳过 Tailor):

./run-sonar-swift.sh -notailor -v

只是为了节省一点时间,因为裁缝需要时间

  1. 启动脚本后... 出现新错误... 但这是一个已知问题:

Error: Caused by: org.sonar.api.measures.PersistenceMode

这里解释了这个问题https://github.com/Backelite/sonar-swift/issues/118

所以我在此处下载了这个 .jar 文件“backelite-sonar-swift-plugin-0.4-sonar-7-quick-fix.jar”https://github.com/Hugal31/sonar-swift/releases/tag/0.4-sonar-7-quick-fix并将其替换为我本地 SonarQube 的插件,然后重试。

......这一次在无数次发射之后我终于看到了曙光🤪💡

希望这个回答对您有所帮助,如果您有任何疑问,请不要犹豫。祝你好运,玩得开心:)

PS:您会在这里找到一些使用参数运行脚本的选项:

./run-sonar-swift.sh -noswiftlint -v (run script with verbose option and skip SwiftLint)

./run-sonar-swift.sh -notailor -v (run script with verbose option and skip Tailor)

./run-sonar-swift.sh -nounittests -v (if your project does not have scheme configured to be tested launch with this parameter)

如果您想了解更多信息,请查看 run-sonar-swift.sh 脚本并查看第 125 行 ## 命令行选项

PS2:如果有帮助,我还在 sonar-swift GitHub 中打开了一个问题:https://github.com/Backelite/sonar-swift/issues/138

关于ios - 无法使脚本 'run-sonar-swift' 工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50304493/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com