@@ -19,36 +19,40 @@ public static List<CodeQuality> ConvertToCodeQualityRaw(FileInfo source, string?
19
19
20
20
var log = JsonConvert . DeserializeObject < SarifLogVersionOne > ( logContents , settings ) ;
21
21
22
- var cqrs = new List < CodeQuality > ( ) ;
23
- foreach ( var result in log . Runs . SelectMany ( x => x . Results ) )
22
+ var results = log . Runs
23
+ . SelectMany ( x => x . Results )
24
+ . Where ( r => r . SuppressionStates == SuppressionStatesVersionOne . None ) ;
25
+
26
+ var cqrs = new List < CodeQuality > ( ) ;
27
+ foreach ( var result in results )
24
28
{
25
29
var begin = result . Locations ? . FirstOrDefault ( ) ;
26
30
27
- if ( begin == null )
28
- {
29
- Log . Warning ( "An issue has no location, skipping: {Result}" , result . Message ) ;
30
- continue ;
31
- }
31
+ if ( begin == null )
32
+ {
33
+ Log . Warning ( "An issue has no location, skipping: {Result}" , result . Message ) ;
34
+ continue ;
35
+ }
32
36
33
- try
37
+ try
38
+ {
39
+ var cqr = new CodeQuality
34
40
{
35
- var cqr = new CodeQuality
41
+ Description = $ "{ result . RuleId } : { result . Message } ",
42
+ Severity = GetSeverity ( result . Level ) ,
43
+ Location = new LocationCq
36
44
{
37
- Description = $ "{ result . RuleId } : { result . Message } ",
38
- Severity = GetSeverity ( result . Level ) ,
39
- Location = new LocationCq
40
- {
41
- Path = GetPath ( pathRoot , begin ) ,
42
- Lines = new Lines { Begin = begin . ResultFile . Region . StartLine }
43
- } ,
44
- Fingerprint = Common . GetHash ( $ "{ result . RuleId } |{ begin . ResultFile . Uri } |{ begin . ResultFile . Region . StartLine } ")
45
- } ;
46
- cqrs . Add ( cqr ) ;
47
- }
48
- catch ( Exception e )
49
- {
50
- Log . Error ( e , "Could not convert {@Result}, skipping" , result ) ;
51
- }
45
+ Path = GetPath ( pathRoot , begin ) ,
46
+ Lines = new Lines { Begin = begin . ResultFile . Region . StartLine }
47
+ } ,
48
+ Fingerprint = Common . GetHash ( $ "{ result . RuleId } |{ begin . ResultFile . Uri } |{ begin . ResultFile . Region . StartLine } ")
49
+ } ;
50
+ cqrs . Add ( cqr ) ;
51
+ }
52
+ catch ( Exception e )
53
+ {
54
+ Log . Error ( e , "Could not convert {@Result}, skipping" , result ) ;
55
+ }
52
56
}
53
57
54
58
return cqrs ;
0 commit comments