Class SarifCommand

java.lang.Object
org.egothor.methodatlas.command.SarifCommand
All Implemented Interfaces:
Command

public final class SarifCommand extends Object implements Command
CLI command handler for the -sarif output mode.

Scans one or more source roots, buffers all discovered test-method records, and serializes the result as a single SARIF 2.1.0 JSON document once the scan completes. When CliConfig.detectSecrets() is enabled, credential findings are detected (via CredentialDetectionRunner) and embedded in the same SARIF document before it is flushed.

See Also:
  • Constructor Details

    • SarifCommand

      public SarifCommand(CliConfig cliConfig, org.egothor.methodatlas.api.TestDiscoveryConfig discoveryConfig, org.egothor.methodatlas.ai.AiSuggestionEngine aiEngine, org.egothor.methodatlas.emit.ClassificationOverride override, AiResultCache aiCache, ScanOrchestrator scanOrchestrator)
      Creates a new SARIF command.
      Parameters:
      cliConfig - full parsed CLI configuration
      discoveryConfig - discovery configuration forwarded to providers
      aiEngine - AI engine providing suggestions; null when AI is disabled
      override - human classification overrides
      aiCache - AI result cache
      scanOrchestrator - scan-and-emit orchestrator used to process all configured roots and buffer SARIF results
  • Method Details

    • execute

      public int execute(PrintWriter out) throws IOException
      Scans all roots and emits the buffered result as SARIF JSON.
      Specified by:
      execute in interface Command
      Parameters:
      out - writer that receives the serialized SARIF document
      Returns:
      0 if all files were processed successfully, 1 if any file produced a parse or processing error
      Throws:
      IOException - if traversing a file tree fails