Class DiffCommand

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

public final class DiffCommand extends Object implements Command
CLI command handler for the -diff mode.

Compares two MethodAtlas scan CSV outputs and emits a delta report showing added, removed, and modified test methods.

When requireJustification is true, every security-relevant method that was removed must have a matching entry in the overrideFile. The command exits with code 1 when any unjustified removal is found.

See Also:
  • DeltaReport
  • DeltaEmitter
  • Constructor Summary

    Constructors
    Constructor
    Description
    DiffCommand(Path before, Path after)
    Creates a new diff command without the removal gate.
    DiffCommand(Path before, Path after, boolean requireJustification, Path overrideFile)
    Creates a new diff command with optional removal-gate enforcement.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Computes and emits the delta between the two scan CSV outputs, and optionally enforces the removal-justification gate.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DiffCommand

      public DiffCommand(Path before, Path after)
      Creates a new diff command without the removal gate.
      Parameters:
      before - path to the before scan CSV
      after - path to the after scan CSV
    • DiffCommand

      public DiffCommand(Path before, Path after, boolean requireJustification, Path overrideFile)
      Creates a new diff command with optional removal-gate enforcement.
      Parameters:
      before - path to the before scan CSV
      after - path to the after scan CSV
      requireJustification - when true, exits non-zero if any security-relevant test was removed without a matching entry in overrideFile
      overrideFile - path to a MethodAtlas override YAML supplying removal justifications; ignored when requireJustification is false; null means no justifications are on file
      Since:
      3.0.0
  • Method Details

    • execute

      public int execute(PrintWriter out) throws IOException
      Computes and emits the delta between the two scan CSV outputs, and optionally enforces the removal-justification gate.
      Specified by:
      execute in interface Command
      Parameters:
      out - writer that receives the delta report
      Returns:
      0 on success; 1 when the removal gate fires
      Throws:
      IOException - if either CSV file cannot be read