realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.58k stars 2.22k forks source link

[Swift] Error when importing swiftlint report #5502

Open cah-iswaria-sasi opened 5 months ago

cah-iswaria-sasi commented 5 months ago

This is for iOS swift project for code smell while using swiftlint , swiftlint(path: “.”, output_file: “sonar-reports/swiftlint.txt”, ignore_exit_status: true), we are seeing results published in sonarqube but if we give below output as .json, no datas are displaying. swiftlint(path: “.”, output_file: “sonar-reports/swiftlint.json”, reporter: “sonarqube”, ignore_exit_status: true) (i referred from swiftlint and sonarqube documentation and created this command)

why this isnt working with .json as per documentation?

SimplyDanny commented 5 months ago

I don't get it. Where do you want to import what from where?

cah-iswaria-sasi commented 5 months ago

swiftlint says swiftlint format for sonarqube should be .json but installed backelite swift plugin, it says swiftlint format is .txt...

however .json isnt working or parsing in sonarqube but swiftlint.txt parses and prints result..

SimplyDanny commented 5 months ago

Sonar itself offers a Swift plugin that can import SwiftLint reports in JSON format. That's what the sonarqube reporter generates.

The Backelite plugin seems to parse the default SwiftLint output (that is the output of the xcode reporter). That's what I conclude from the regex used in their parser. So if you use this third-party plugin instead of the official one from Sonar, you need to pipe the normal SwiftLint output into a txt file instead of using the sonarqube output.

cah-iswaria-sasi commented 5 months ago

we have duplications block which is reported as 0% but we have duplications in files. we are using your plugin for swift project analysis. can you please tell why is it so not working or its following any algorithm or methodology that we need to be aware of

SimplyDanny commented 5 months ago

Analysis of duplicated code is not part of SwiftLint. It might only be part of the Sonar plugins and I've never used any of them. Therefore, I cannot help you with that.