Package org.egothor.methodatlas.emit
Class GitHubAnnotationsEmitter
java.lang.Object
org.egothor.methodatlas.emit.GitHubAnnotationsEmitter
- All Implemented Interfaces:
TestMethodSink
Emits GitHub Actions workflow commands for inline PR annotations.
Only security-relevant methods produce output. Each method becomes one
::notice or ::warning line that GitHub Actions intercepts
and renders as an inline annotation on the PR diff:
::warning— whenai_interaction_score >= 0.8: the test only verifies that methods were called, not what they returned.::notice— otherwise: a well-formed security test worth reviewing.
The file path in each annotation is constructed as
<filePrefix><fqcn-as-path>.java, where filePrefix is
derived from the first configured scan root (e.g. src/test/java/).
This produces paths like src/test/java/com/acme/AuthTest.java,
which GitHub resolves to the correct inline position in the PR diff for
standard Maven / Gradle source layouts.
This mode does not require a GitHub Advanced Security licence, unlike
SARIF upload via the upload-sarif action.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleInteraction score at or above which a security test is flagged as a potential placebo. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringescapeMessage(String value) Encodes characters that would break a GitHub workflow command message.static StringescapeParam(String value) Encodes characters that would break a GitHub workflow command parameter value.static StringformatCommand(String level, String filePath, int beginLine, String title, String message) Formats a GitHub Actions workflow command line.voidrecord(String fqcn, String method, int beginLine, int loc, String contentHash, List<String> tags, String displayName, AiMethodSuggestion suggestion) Records a single test method.
-
Field Details
-
PLACEBO_THRESHOLD
public static final double PLACEBO_THRESHOLDInteraction score at or above which a security test is flagged as a potential placebo.- See Also:
-
-
Constructor Details
-
GitHubAnnotationsEmitter
- Parameters:
out- writer that receives the annotation linesfilePrefix- prefix prepended to the FQCN-derived file path, including a trailing slash (e.g."src/test/java/"); empty string when the scan root is already the repo root
-
-
Method Details
-
record
public void record(String fqcn, String method, int beginLine, int loc, String contentHash, List<String> tags, String displayName, AiMethodSuggestion suggestion) Description copied from interface:TestMethodSinkRecords a single test method.- Specified by:
recordin interfaceTestMethodSink- Parameters:
fqcn- fully qualified name of the class that declares the methodmethod- simple method namebeginLine- one-based line number of the first line of the method declaration;0when the parser cannot determine the locationloc- inclusive line count of the method declarationcontentHash- lowercase-hex SHA-256 fingerprint of the enclosing class source, ornullwhen-content-hashis not enabledtags- source-level test-framework tag values declared on the method; nevernulldisplayName- text from an existing display-name annotation on the method;nullwhen no such annotation is present;""when the annotation is present but has an empty value — which is a malformed annotation and may be treated as a quality finding by implementationssuggestion- AI-generated security classification for the method, ornullwhen AI enrichment is disabled or unavailable for this class
-
formatCommand
public static String formatCommand(String level, String filePath, int beginLine, String title, String message) Formats a GitHub Actions workflow command line. -
escapeParam
Encodes characters that would break a GitHub workflow command parameter value. -
escapeMessage
Encodes characters that would break a GitHub workflow command message.
-