【问题标题】:Display SwiftLint analyze results in Xcode在 Xcode 中显示 SwiftLint 分析结果
【发布时间】:2021-09-01 22:42:04
【问题描述】:

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

使用xcode formatter/reporter 创建了这个结构的文件:

/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 扩展,但我希望这已经得到解决。

【问题讨论】:

    标签: swift xcode static-code-analysis swiftlint


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2010-11-01
      • 1970-01-01
      • 2014-10-29
      • 1970-01-01
      • 1970-01-01
      • 2021-12-29
      • 1970-01-01
      • 2017-07-09
      • 1970-01-01
      相关资源
      最近更新 更多