Skip to content

Commit 463ad78

Browse files
authored
Fix/sarif structure (#283)
* remove fingerprint from sarif; change text to queryName or Id if not exists * keep text as queryName * remove circleci from readme
1 parent 12a779f commit 463ad78

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
[![CircleCI](https://circleci.com/gh/CheckmarxDev/ast-cli/tree/master.svg?style=svg&circle-token=32eeef7505db60c11294e63db64e70882bde83b0)](https://circleci.com/gh/CheckmarxDev/ast-cli/tree/master)
21
## Building from source code
32
### Windows
43
``` powershell

internal/commands/result.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,7 @@ func findRule(ruleIds map[interface{}]bool, result *wrappers.ScanResult) *wrappe
373373
func findResult(result *wrappers.ScanResult) *wrappers.SarifScanResult {
374374
var scanResult wrappers.SarifScanResult
375375
scanResult.RuleID = getRuleID(result.ScanResultData.QueryID)
376-
scanResult.Message.Text = result.Comments.Comments
377-
scanResult.PartialFingerprints.PrimaryLocationLineHash = result.SimilarityID
376+
scanResult.Message.Text = result.ScanResultData.QueryName
378377
scanResult.Locations = []wrappers.SarifLocation{}
379378

380379
for _, node := range result.ScanResultData.Nodes {

internal/wrappers/results-sarif.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ type SarifDriverRule struct {
3535
}
3636

3737
type SarifScanResult struct {
38-
RuleID string `json:"ruleId"`
39-
Message SarifMessage `json:"message"`
40-
PartialFingerprints SarifResultFingerprint `json:"partialFingerprints"`
41-
Locations []SarifLocation `json:"locations,omitempty"`
38+
RuleID string `json:"ruleId"`
39+
Message SarifMessage `json:"message"`
40+
PartialFingerprints *SarifResultFingerprint `json:"partialFingerprints,omitempty"`
41+
Locations []SarifLocation `json:"locations,omitempty"`
4242
}
4343

4444
type SarifLocation struct {
@@ -65,5 +65,5 @@ type SarifMessage struct {
6565
}
6666

6767
type SarifResultFingerprint struct {
68-
PrimaryLocationLineHash string `json:"primaryLocationLineHash"`
68+
PrimaryLocationLineHash string `json:"primaryLocationLineHash,omitempty"`
6969
}

0 commit comments

Comments
 (0)