File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ # This jq filter transforms a mutation testing report to the SonarQube generic issue import format.
2+
3+ .framework.name as $frameworkName
4+ | .projectRoot as $projectRoot
5+ | .files
6+ | to_entries
7+ | {
8+ issues : map (
9+ .value.mutants [] as $mutants
10+ | del (.value ) as $file
11+ | $mutants
12+ | select (.status == ("Survived" , "NoCoverage" ))
13+ | (
14+ if .replacement then
15+ "The " + .mutatorName + " was mutated to " + .replacement + " without any tests failing."
16+ else
17+ "The " + .mutatorName + " was mutated without any tests failing."
18+ end
19+ ) as $mutation
20+ | {
21+ engineId : ($frameworkName // "Mutation Testing" ),
22+ ruleId : ("Mutant" + .status ),
23+ primaryLocation : {
24+ message : (
25+ if .status == "NoCoverage" then
26+ "A mutant was not covered by any of the tests. " + $mutation
27+ else
28+ "A mutant survived after running the tests. " + $mutation
29+ end
30+ ),
31+ filePath : (
32+ if $projectRoot then
33+ $file .key | sub ("^" + $projectRoot + "/" ; "" )
34+ else
35+ $file .key
36+ end
37+ ),
38+ textRange : {
39+ startLine : .location.start.line ,
40+ endLine : .location.end.line ,
41+ startColumn : (.location.start.column - 1 ),
42+ endColumn : (.location.end.column - 1 )
43+ }
44+ },
45+ type : "CODE_SMELL" ,
46+ severity : "MAJOR" ,
47+ effortMinutes : 10
48+ }
49+ )
50+ }
You can’t perform that action at this time.
0 commit comments