Closed josejobin45 closed 7 months ago
I need an example report file
Here you go. This is an example JSON format.
{
"type": "Coverity issues",
"formatVersion": 7,
"suppressedIssueCount": 0,
"issues": [
{
"mergeKey": "example_merge_key",
"occurrenceCountForMK": 1,
"occurrenceNumberInMK": 1,
"referenceOccurrenceCountForMK": null,
"checkerName": "example_checker_name",
"subcategory": "example_subcategory",
"type": "example_type",
"subtype": "example_subtype",
"code-language": "example_code_language",
"extra": "example_extra",
"domain": "example_domain",
"language": "example_language",
"mainEventFilePathname": "example_file_path",
"strippedMainEventFilePathname": "example_stripped_file_path",
"mainEventLineNumber": 123,
"properties": {},
"functionDisplayName": "example_function_display_name",
"functionMangledName": "example_function_mangled_name",
"localStatus": null,
"ordered": false,
"events": [
{
"covLStrEventDescription": "example_event_description",
"eventDescription": "example_event_description",
"eventNumber": 1,
"eventTreePosition": "1",
"eventSet": 0,
"eventTag": "example_event_tag",
"filePathname": "example_file_path",
"strippedFilePathname": "example_stripped_file_path",
"lineNumber": 123,
"main": true,
"moreInformationId": null,
"remediation": false,
"events": null
}
],
"stateOnServer": null,
"checkerProperties": {
"category": "example_category",
"categoryDescription": "example_category_description",
"cweCategory": "example_cwe_category",
"issueKinds": [
"example_issue_kind"
],
"eventSetCaptions": [],
"impact": "example_impact",
"impactDescription": "example_impact_description",
"subcategoryLocalEffect": "example_subcategory_local_effect",
"subcategoryShortDescription": "example_subcategory_short_description",
"subcategoryLongDescription": "example_subcategory_long_description"
}
}
],
"desktopAnalysisSettings": null,
"error": null,
"warnings": []
}
I dont see any obvious mapping to the Violation model used by this library. It would perhaps be easier to see if the example was not so anonymous.
Sorry for the late reply. Will this JSON help?
{
"type" : "Coverity issues",
"formatVersion" : 7,
"suppressedIssueCount" : 0,
"issues" : [
{
"mergeKey" : "884ed7531feed32eb916d9038a3b9bd6",
"occurrenceCountForMK" : 1,
"occurrenceNumberInMK" : 1,
"referenceOccurrenceCountForMK" : null,
"checkerName" : "CONSTANT_EXPRESSION_RESULT",
"subcategory" : "bit_and_with_zero",
"type" : "constant_expression_result",
"subtype" : "bit_and_with_zero",
"code-language" : "c#",
"extra" : "status",
"domain" : "STATIC_CS",
"language" : "C#",
"mainEventFilePathname" : "C:\\Workspace\\workspace\\Build_jenkins_development\\somefile.cs",
"strippedMainEventFilePathname" : "\\workspace\\Build_jenkins_development\\Architecture\\somefile.cs",
"mainEventLineNumber" : 79,
"properties" : {},
"functionDisplayName" : "somename",
"functionMangledName" : "somename",
"localStatus" : null,
"ordered" : false,
"events" : [
{
"covLStrEventDescription" : "{CovLStrv2{{t{{0} is always 0.}{{code{status & System.Printing.PrintJobStatus.None}}}}{t{ This occurs as a value.}}}}",
"eventDescription" : "\"status & System.Printing.PrintJobStatus.None\" is always 0. This occurs as a value.",
"eventNumber" : 1,
"eventTreePosition" : "1",
"eventSet" : 0,
"eventTag" : "bit_and_with_zero",
"filePathname" : "C:\\Workspace\\workspace\\Build_jenkins_development\\somefile.cs",
"strippedFilePathname" : "\\workspace\\Build_jenkins_development\\Architecture\\somefile.cs",
"lineNumber" : 79,
"main" : true,
"moreInformationId" : null,
"remediation" : false,
"events" : null
}
],
"stateOnServer" : null,
"checkerProperties" : {
"category" : "Integer handling issues",
"categoryDescription" : "Integer handling issues",
"cweCategory" : "569",
"issueKinds" : [
"QUALITY"
],
"eventSetCaptions" : [],
"impact" : "Medium",
"impactDescription" : "Medium",
"subcategoryLocalEffect" : "The expression's value is always zero; construct may indicate an inadvertent logic error.",
"subcategoryShortDescription" : "Bitwise-and with zero",
"subcategoryLongDescription" : "Bitwise-and ('&') operation applied to zero always produces zero"
}
}
]
"desktopAnalysisSettings" : null,
"error" : null,
"warnings" : []
}
Alternatively I could convert the JSON to below format
{
"Type": "coverity issues",
"issues": [
{
"fileName": "test.xml",
"severity": "ERROR",
"lineStart": 110,
"lineEnd": 111,
"columnStart": 210,
"columnEnd": 220,
"message": "some message",
"description": "some description"
}
]
}
But I believe you are against implementing a generic parser. Is there a workaround ?
Do you have any suggestions on other parsers to which I can convert these results?
How would you construct the "some message" string?
Right now i am using "issue.checkerProperties.subcategoryLocalEffect" for it For description "issue.checkerProperties.subcategoryLongDescription" For category "issue.checkerProperties.category" For filename "issue.mainEventFilePathname" For severity "issue.checkerProperties.impact"
If it's too much effort, could you suggest alternative parsers.
Can you take a look at this: https://github.com/tomasbjerre/violations-lib/pull/187
Is that good?
Yes, This looks good. Thanks
Ok, releasing it now.
Hi,
Could you add support for Coverity report (JSON v7) files. I am adding a type script which provides the type of data structure it has.