Class DeltaReport

java.lang.Object
org.egothor.methodatlas.DeltaReport

public final class DeltaReport extends Object
Computes the difference between two MethodAtlas scan outputs.

Overview

compute(Path, Path) parses two MethodAtlas CSV files produced by separate scan runs and returns a DeltaReport.DeltaResult that enumerates every test method that was added, removed, or modified between the runs. Unchanged methods are counted but not listed individually.

Method identity

Two records are considered to represent the same method when their fqcn and method columns match exactly. If a class or method is renamed between scans, the old name appears as REMOVED and the new name appears as ADDED. MethodAtlas does not attempt to track renames.

Comparable fields

For each method present in both scans, the following fields are compared:

  • loc — lines of code; always compared
  • tags — JUnit @Tag set; always compared (order-independent)
  • display_name@DisplayName annotation value; always compared; null (column absent from the CSV) and "" (column present but no annotation on the method) are both treated as "no annotation" and considered equal, so comparing an old-format file against a new-format file does not produce false positives for methods that have no annotation in either scan
  • content_hash — source fingerprint; compared only when both records have a non-null value (i.e., both scans were run with -content-hash); a hash difference indicates the enclosing class source was edited
  • ai_security_relevant — compared only when both records carry a non-null value (both scans used -ai)
  • ai_tags — compared only when both records carry a non-null value; comparison is order-independent

Fields absent from either record (i.e., produced by scans with different flag sets) are skipped so that a scan with -content-hash can be meaningfully compared with one that did not use that flag.

CSV format compatibility

The parser handles the MethodAtlas CSV dialect (RFC 4180, comma-delimited, double-quote escaping). #-prefixed comment lines emitted by -emit-metadata are skipped; the scan_timestamp metadata value is extracted and forwarded to DeltaReport.DeltaResult for display. Blank lines are ignored. Unknown column names are ignored, making the parser forward-compatible with columns added in future versions.

See Also:
  • Method Details

    • compute

      public static DeltaReport.DeltaResult compute(Path beforeCsv, Path afterCsv) throws IOException
      Computes the difference between two MethodAtlas scan CSV files.

      Both files must be readable and must contain at least a CSV header row with fqcn and method columns. Empty files (no data rows) are handled gracefully and produce only ADDED or REMOVED entries as appropriate.

      Parameters:
      beforeCsv - path to the scan output from the earlier run
      afterCsv - path to the scan output from the later run
      Returns:
      delta result; never null
      Throws:
      IOException - if either file cannot be read
      IllegalArgumentException - if a required column (fqcn or method) is absent from a file