We are trying to display warnings in sonarqube server using Generic Issues Import Format
Below is our json format that we have formed:-
{
"issues": [
{
"engineId": "Compiler Warning",
"ruleId": "Warning",
"severity": "MAJOR",
"type": "CODE_SMELL",
"primaryLocation": {
"message": " Unnecessary safe call on a non-null receiver of type CMAnimatedImage?",
"filePath": "path to the file",
"textRange": {
"startLine": "20",
"endLine": "20"
}
}
}
]
}
We are settings the below configurations in the sonarqube configurations file:-
property “sonar.issuesReport.json.enable”, “true”
property “sonar.externalIssuesReportPaths”, file("${rootProject.projectDir}/SonarQubeIssueData.json")
I’m not sure whether you’ve deliberately obfuscated it, but your filePath looks strange. Is it really "path to the file" or do you have an actual filename (relative to the root of the project) here?
I’ve run a quick test with your JSON and (assuming the path name is valid) it works fine, so the specification of the issue is not the problem. Looking at your configuration
it looks like you’re using Gradle, is that correct? I just tried this with Gradle and it works fine. If the configuration is correct and you run your Gradle analysis with --debug you should see something like the following in your log file: