Skip to content

Commit

Permalink
Checkmarx results parser - Normalize paths (#71)
Browse files Browse the repository at this point in the history
* feat: Normalize FileName path to linux

* style: Fix formatting
  • Loading branch information
cx-rafaelc authored May 3, 2024
1 parent af5ffc1 commit 7cfea6d
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,17 @@ private TestCaseResult parseCheckmarxFindings(
// get the testcase number
// Try get testcase from the first node
JSONArray nodes = result.getJSONArray("Nodes");
String resultFileName = nodes.getJSONObject(0).getString("FileName");
String testcaseName = resultFileName.substring(resultFileName.lastIndexOf('\\') + 1);
String resultFileName = nodes.getJSONObject(0).getString("FileName").replace("\\", "/");
String testcaseName = resultFileName.substring(resultFileName.lastIndexOf('/') + 1);
if (testcaseName.startsWith(BenchmarkScore.TESTCASENAME)) {
tcr.setNumber(testNumber(testcaseName));
return tcr;
} else {
resultFileName = nodes.getJSONObject(nodes.length() - 1).getString("FileName");
testcaseName = resultFileName.substring(resultFileName.lastIndexOf('\\') + 1);
resultFileName =
nodes.getJSONObject(nodes.length() - 1)
.getString("FileName")
.replace("\\", "/");
testcaseName = resultFileName.substring(resultFileName.lastIndexOf('/') + 1);
if (testcaseName.startsWith(BenchmarkScore.TESTCASENAME)) {
tcr.setNumber(testNumber(testcaseName));
return tcr;
Expand Down

0 comments on commit 7cfea6d

Please sign in to comment.