Integrate SwiftLint in SonarCloud

  • Im using an Mac and for CI/CD im using Xcode Cloud

  • I have an App written in Swift on Xcode and I want to integrate SwiftLint to SonarCloud with my CI/CD.

  • I added this line to my Script to send Sonarcloud the report file from SwiftLint:
    -Dsonar.swift.swiftLint.reportPaths=swiftlint_report.xml

SwiftLint creates a XML report file but when SonarCloud wants to import the file I get this massage in the Logs:
ERROR No issues information will be saved as the report file can’t be read.

Is it because Sonarcloud cannot read xml files? and if its true,
then how can I avoid it?

Hi,

Welcome to the community!

This could have multiple causes:

  • the file doesn’t exist at that location
  • the file is locked by another process
  • the file isn’t in a format that’s readable by analysis

Was there any more detail to that error? Can you provide us with a debug analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann