Record Class ReviewFinding
java.lang.Object
java.lang.Record
com.tnsai.quality.security.harness.ReviewFinding
- Record Components:
id- stable identifier; same finding across re-runs MUST produce the same id (used for de-duplication)file- source file path, relative to the project rootstartLine- 1-based start line;0= file-level findingendLine- 1-based end line;>= startLinecwe- CWE identifier (e.g."CWE-89"for SQL injection); empty when no CWE appliesseverity-Severityclassificationtitle- one-line headline ("SQL injection in user lookup")description- multi-line explanation of the issueevidence- code snippet that demonstrates the issue; should be the smallest reproducer, not the full filemitigation- optional fix suggestion ("use prepared statements")matcher- id of theMatcherSpithat fired, or"agent:<agent-id>"if produced by an agentagentBackend- id of the agent backend ("claude-opus-4-7"); empty for matcher-only findingsmetadata- free-form extension key/values; nevernull
public record ReviewFinding(String id, Path file, int startLine, int endLine, String cwe, Severity severity, String title, String description, String evidence, Optional<String> mitigation, String matcher, String agentBackend, Map<String,String> metadata)
extends Record
One vulnerability discovered by the code-review pipeline (TNS-291).
Findings are produced by either a static MatcherSpi (the
scan stage) or a ReviewAgentSpi (the process stage). They are
the canonical unit of output — exporters serialise them into SARIF /
JSON / Markdown.
- Since:
- 0.10.0 (TNS-291)
-
Constructor Summary
ConstructorsConstructorDescriptionReviewFinding(String id, Path file, int startLine, int endLine, String cwe, Severity severity, String title, String description, String evidence, Optional<String> mitigation, String matcher, String agentBackend, Map<String, String> metadata) Creates an instance of aReviewFindingrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theagentBackendrecord component.cwe()Returns the value of thecwerecord component.Returns the value of thedescriptionrecord component.intendLine()Returns the value of theendLinerecord component.final booleanIndicates whether some other object is "equal to" this one.evidence()Returns the value of theevidencerecord component.file()Returns the value of thefilerecord component.static ReviewFindingfromMatcher(String id, Path file, int startLine, int endLine, String cwe, Severity severity, String title, String description, String evidence, String matcherId) Convenience for matcher-only (static) findings — no agent backend.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.matcher()Returns the value of thematcherrecord component.metadata()Returns the value of themetadatarecord component.Returns the value of themitigationrecord component.severity()Returns the value of theseverityrecord component.intReturns the value of thestartLinerecord component.title()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ReviewFinding
public ReviewFinding(String id, Path file, int startLine, int endLine, String cwe, Severity severity, String title, String description, String evidence, Optional<String> mitigation, String matcher, String agentBackend, Map<String, String> metadata) Creates an instance of aReviewFindingrecord class.- Parameters:
id- the value for theidrecord componentfile- the value for thefilerecord componentstartLine- the value for thestartLinerecord componentendLine- the value for theendLinerecord componentcwe- the value for thecwerecord componentseverity- the value for theseverityrecord componenttitle- the value for thetitlerecord componentdescription- the value for thedescriptionrecord componentevidence- the value for theevidencerecord componentmitigation- the value for themitigationrecord componentmatcher- the value for thematcherrecord componentagentBackend- the value for theagentBackendrecord componentmetadata- the value for themetadatarecord component
-
-
Method Details
-
fromMatcher
public static ReviewFinding fromMatcher(String id, Path file, int startLine, int endLine, String cwe, Severity severity, String title, String description, String evidence, String matcherId) Convenience for matcher-only (static) findings — no agent backend. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
file
Returns the value of thefilerecord component.- Returns:
- the value of the
filerecord component
-
startLine
public int startLine()Returns the value of thestartLinerecord component.- Returns:
- the value of the
startLinerecord component
-
endLine
public int endLine()Returns the value of theendLinerecord component.- Returns:
- the value of the
endLinerecord component
-
cwe
Returns the value of thecwerecord component.- Returns:
- the value of the
cwerecord component
-
severity
Returns the value of theseverityrecord component.- Returns:
- the value of the
severityrecord component
-
title
Returns the value of thetitlerecord component.- Returns:
- the value of the
titlerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
evidence
Returns the value of theevidencerecord component.- Returns:
- the value of the
evidencerecord component
-
mitigation
Returns the value of themitigationrecord component.- Returns:
- the value of the
mitigationrecord component
-
matcher
Returns the value of thematcherrecord component.- Returns:
- the value of the
matcherrecord component
-
agentBackend
Returns the value of theagentBackendrecord component.- Returns:
- the value of the
agentBackendrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-