I am also trying to achieve same thing and succeeded around 90% but need small help!
I have added below json file using generic issue format and I getting only single code smell. Path, line number etc are correct but not sure what I am doing wrong.
{
"issues": [
{
"engineId": "Compiler Warning",
"ruleId": "Warning",
"severity": "MAJOR",
"type": "CODE_SMELL",
"primaryLocation": {
"message": " initialization of immutable value 'myname' was never used; consider replacing with assignment to '_' or removing it",
"filePath": "XXXX/HomeVC.swift",
"textRange": {
"startLine": "29",
"endLine": "29"
}
}
},
{
"engineId": "Compiler Warning",
"ruleId": "Warning",
"severity": "MAJOR",
"type": "CODE_SMELL",
"primaryLocation": {
"message": " variable 'self' was written to, but never read",
"filePath": "XXXX/ManageAccountVC.swift",
"textRange": {
"startLine": "159",
"endLine": "159"
}
}
},
{
"engineId": "Compiler Warning",
"ruleId": "Warning",
"severity": "MAJOR",
"type": "CODE_SMELL",
"primaryLocation": {
"message": " using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead",
"filePath": "XXXX/ReachabilityType.swift",
"textRange": {
"startLine": "3",
"endLine": "3"
}
}
}
]
}
I am getting code smell for HomeVC but not getting for others file.
I’ve split your response into a separate thread since it’s a bit tangential (and kudos for scratching your own itch, here!).
Thanks for being specific about which 1 issue you do get. On the face of it, your report looks right, so my first step was to drop it into a JSON formatter. JSON Formatter & Validator is pretty awesome, and it immediately flagged errors on your startLine and endLine values. as “Invalid number”. So then I checked the spec, and sure enough those should be integer values, not strings. I.e. they should be unquoted.
What does your analysis log say about the import of this report? If there’s nothing interesting, can you try running it with debug logging to see if something interesting does crop up? Also, could you try moving the successful issue from the top to the bottom of the report? I’m curious whether it’s processing only the first issue, or only that issue.
Found the root cause, feature branch will show code smell which is generated by new code, not the other one which is existing one. Existing one will show only in develop branch.
So same rule applicable for “Generic Issue Format”, in HomeViewController It was showing because where I added new code which is generating code smell. I checked for develop branch where is showing all the code smell which I passed in my json.