gpt4 book ai didi

swift - 在 Xcode 中显示 SwiftLint 分析结果

转载 作者:行者123 更新时间:2023-12-05 03:40:48 25 4
gpt4 key购买 nike

我正在测试 SwiftLint 的(实验性的)analyze功能并能够生成报告。现在我想让它们回到 Xcode 中并将它们显示为警告和错误。

使用 xcode 格式化程序/报告程序创建了一个具有这种结构的文件:

/absolute/path/to/source/Scenes/UpdateOS/UpdateOSViewModel.swift:10:6: error: Unused Declaration Violation: Declarations should be referenced at least once within all files linted. (unused_declaration)
/absolute/path/to/source/Scenes/UpdateOS/UpdateOSViewModel.swift:11:6: error: Unused Declaration Violation: Declarations should be referenced at least once within all files linted. (unused_declaration)
/absolute/path/to/source/Scenes/UpdateOS/UpdateOSViewController.swift:7:7: error: Unused Declaration Violation: Declarations should be referenced at least once within all files linted. (unused_declaration)
/absolute/path/to/source/Scenes/Home/Cells/Statistics/HomeStatisticsCellModel.swift:5:1: warning: Unused Import Violation: All imported modules should be required to make the file compile. (unused_import)
/absolute/path/to/source/Scenes/Home/Cells/Statistics/HomeStatisticsCellModel.swift:6:1: warning: Unused Import Violation: All imported modules should be required to make the file compile. (unused_import)
/absolute/path/to/source/Scenes/Home/Cells/Statistics/HomeStatisticsCard.swift:5:1: warning: Unused Import Violation: All imported modules should be required to make the file compile. (unused_import)
/absolute/path/to/source/Scenes/Home/Cells/Statistics/Extensions/SAP_Internal_Stats_Statistics+SupportedIDs.swift:5:1: warning: Unused Import Violation: All imported modules should be required to make the file compile. (unused_import)
/absolute/path/to/source/Scenes/Home/Cells/TraceLocations/HomeTraceLocationsCellModel.swift:10:6: error: Unused Declaration Violation: Declarations should be referenced at least once within all files linted. (unused_declaration)
/absolute/path/to/source/Scenes/Home/Cells/TraceLocations/HomeTraceLocationsCellModel.swift:11:6: error: Unused Declaration Violation: Declarations should be referenced at least once within all files linted. (unused_declaration)
/absolute/path/to/source/Scenes/Home/Cells/TraceLocations/HomeTraceLocationsCellModel.swift:12:6: error: Unused Declaration Violation: Declarations should be referenced at least once within all files linted. (unused_declaration)

有没有一种通用的方法可以将警告/错误列表“加载”到 Xcode 中?我的第一个方法是 XcodeKit延期,但我希望这已经得到解决。

最佳答案

我猜你已经找到了答案,但如果你没有找到:error:warning: 会在 Xcode 中自动解析和处理,所以如果您将命令添加为“运行脚本”构建阶段就足够了。

关于swift - 在 Xcode 中显示 SwiftLint 分析结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68014062/

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