Skip to content

Commit f10f27c

Browse files
author
Dave Wichers
committed
Parse out SemGrep version in Semgrep JSON parser.
1 parent 04ad5ab commit f10f27c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plugin/src/main/java/org/owasp/benchmarkutils/score/parsers/SemgrepReader.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.owasp.benchmarkutils.score.parsers;
1919

2020
import org.json.JSONArray;
21+
import org.json.JSONException;
2122
import org.json.JSONObject;
2223
import org.owasp.benchmarkutils.score.BenchmarkScore;
2324
import org.owasp.benchmarkutils.score.CweNumber;
@@ -39,9 +40,16 @@ public TestSuiteResults parse(ResultFile resultFile) throws Exception {
3940
TestSuiteResults tr =
4041
new TestSuiteResults("Semgrep", false, TestSuiteResults.ToolType.SAST);
4142

43+
// get engine version
44+
try {
45+
String version = resultFile.json().getString("version");
46+
tr.setToolVersion(version);
47+
} catch (JSONException e) {
48+
// If there is no version value, ignore it.
49+
}
50+
4251
JSONArray results = resultFile.json().getJSONArray("results");
4352

44-
// engine version
4553
// duration time
4654

4755
// results

0 commit comments

Comments
 (0)