I'm testing SwiftLint's (experimental) analyze feature and am able to generate reports. Now I would like to get them back into Xcode and display these as warnings and errors.
Using the xcode formatter/reporter a file of this structure was created:
/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)
Is there a general way to 'load' a list of warnings/errors into Xcode? My first approach was an XcodeKit extension but I have hope this is already tackled.
I guess you already found out the answer, but in case you didn't: error: and warning: are automatically parsed and handled in Xcode as such, so it's enough if you add the command as "Run Script" Build phase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With