Skip to content

Commit

Permalink
Fix typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Mar 15, 2024
1 parent d2a575f commit c983f27
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/main/java/edu/hm/hafner/analysis/parser/GrypeParser.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package edu.hm.hafner.analysis.parser;

import static j2html.TagCreator.a;
import static j2html.TagCreator.p;

import org.json.JSONArray;
import org.json.JSONObject;

Expand All @@ -11,9 +8,13 @@
import edu.hm.hafner.analysis.Report;
import edu.hm.hafner.analysis.Severity;

import static j2html.TagCreator.*;

/**
* JSON report parser for grype (https://plugins.jenkins.io/grypescanner/ /
* https://github.com/anchore/grype).
* JSON report parser for grype.
*
* @see <a href="https://plugins.jenkins.io/grypescanner/">Jenkins Plugin GrypeScanner</a>
* @see <a href="https://github.com/anchore/grype">grype</a>
*/
public class GrypeParser extends JsonIssueParser {
private static final long serialVersionUID = -1369431674771459756L;
Expand Down Expand Up @@ -44,7 +45,7 @@ protected void parseJsonObject(final Report report, final JSONObject jsonReport,
}

private Issue getIssue(final IssueBuilder issueBuilder, final JSONObject match) {
JSONObject vuln = match.getJSONObject(VULNERABILIY_TAG);
JSONObject vulnerability = match.getJSONObject(VULNERABILIY_TAG);
JSONObject artifact = match.getJSONObject(ARTIFACT_TAG);
String fileName = artifact.getJSONArray(LOCATIONS_TAG).getJSONObject(0).getString(PATH_TAG);
String packageName = artifact.optString(NAME_TAG, "Unknown");
Expand All @@ -56,14 +57,13 @@ private Issue getIssue(final IssueBuilder issueBuilder, final JSONObject match)
return issueBuilder.setFileName(fileName)
.setPackageName(packageName)
.setCategory(artifact.optString(TYPE_TAG, "Unknown"))
.setSeverity(Severity.guessFromString(vuln.getString(SEVERITY_TAG)))
.setType(vuln.getString(ID_TAG))
.setMessage(vuln.optString(DESCRIPTION_TAG, "Unknown"))
.setOriginName("Grype")
.setSeverity(Severity.guessFromString(vulnerability.getString(SEVERITY_TAG)))
.setType(vulnerability.getString(ID_TAG))
.setMessage(vulnerability.optString(DESCRIPTION_TAG, "Unknown"))
.setPathName(fileName)
.setDescription(p().with(a()
.withHref(vuln.getString(DATA_SOURCE_TAG))
.withText(vuln.getString(DATA_SOURCE_TAG))).render())
.withHref(vulnerability.getString(DATA_SOURCE_TAG))
.withText(vulnerability.getString(DATA_SOURCE_TAG))).render())
.build();
}
}

0 comments on commit c983f27

Please sign in to comment.