Open Absh-Day opened 1 year ago
Can you share any of your json or sonarqube reporter output files, suitably obfuscated?
I also have the same issue. Did you find a fix for this?
I'm having the same issue using the sonarqube
reporter!
The problem seems to be related with the way that the JSON report is generated when using the sonarqube
reporter. The complain of the stack trace is that it found an object container instead of an array. Checking the report generated by SwiftLint, the formatting is:
{
"issues" : [
{
"engineId" : "SwiftLint",
"primaryLocation" : {
"filePath" : "MyProject\/Models\/JSON.swift",
"message" : "Use `Self` to refer to the surrounding type name",
"textRange" : {
"startLine" : 29
}
},
"ruleId" : "prefer_self_in_static_references",
"severity" : "MINOR",
"type" : "CODE_SMELL"
}
]
}
I believe that by removing the object with the issues
field and leaving only the array should solve the issue. But I haven't tested it yet. I'm probably going to write a script to do it and try to upload the SwiftLint report again. I can come back with the results I get later.
Since the reporters json
and sonarqube
produce very different json reports though, I expect this to not work at first. Maybe using the json
with a script to strip the workspace path is the way to go for now.
New Issue Checklist
Describe the bug
A clear and concise description of what the bug is.
Complete output when running SwiftLint, including the stack trace and command used
When I run
swiftlint --reporter json
and then try to upload that json file to sonarqube(developer edition), it shows warnings like this while uploading report and in end does not upload because absolute path won't exist on Sonar:The report can also not be uploaded when I run
swiftlint --reporter sonarqube
and this is whats thrown as exception:So it seems sonarqube reporter needs to be reviewed completely and json reporter should be flexible enough to account sonar.Sources value. Can someone fix that?
For now, I am running json reporter, then using script to strip the workspace path, and remove backslashes in file paths(from json) and then the uploads works just fine.
Environment