feat: SARIF 2.1.0 and Checkstyle XML reports for check/fix
Some checks are pending
CI / lint (push) Waiting to run
CI / test (ubuntu-latest) (push) Waiting to run
CI / test (windows-latest) (push) Waiting to run

--report FILE on check and fix writes the findings a run already
computed into CI-consumable formats chosen by extension: .sarif
(single run, %SRCROOT%-relative URIs, properties.autoFixable, rule
registry with descriptions) and .xml (Checkstyle, source=jmove.<rule>).
Unknown suffixes fail fast with INVALID_ARGUMENT; stdout and exit codes
are untouched, and clean runs write valid empty documents.

The check handler moved into cli::report (its format siblings); fix
emits the candidate list in dry-run and apply modes. Marketing angle
from the plan: auto-fix for what Checkstyle only reports.
This commit is contained in:
loki5512344 2026-09-15 20:23:20 +02:00
parent 47395069cb
commit ad1ad4f999
Signed by: boba
GPG key ID: 253067914055423B
10 changed files with 726 additions and 56 deletions

View file

@ -57,7 +57,7 @@ Exit code never changes; surface the list to the user.
### check — find broken imports and Java layout errors
```
jmove check [--root DIR] [--json]
jmove check [--root DIR] [--json] [--report FILE]
```
Run after any move (or any edit) to validate project consistency. Reports
@ -65,10 +65,22 @@ broken relative imports and Java files whose single public type is named
differently from the file (each finding carries the exact `jmove mv` that
renames it; exit code 2 covers both kinds).
### report files — SARIF and Checkstyle for CI/IDE
`check` and `fix` accept `--report FILE`; the format is chosen by the file
name suffix: `.sarif` → SARIF 2.1.0 (single run, `%SRCROOT%`-relative
artifact URIs, `properties.autoFixable`), `.xml` → Checkstyle XML
(`source="jmove.<rule>"` with `/` mapped to `.`). Unknown suffixes fail
before any work with `INVALID_ARGUMENT`. The report mirrors what the run
already computed (fix: candidates with their applied/manual status; dry-run
included), stdout and exit codes stay as without `--report`, and clean runs
write valid *empty* documents. Rule ids: the four fix rules above, plus
`broken-import` and `java/class-name-mismatch`.
### fix — auto-repair import problems
```
jmove fix [--root DIR] [--rule ID] [--dry-run] [--json]
jmove fix [--root DIR] [--rule ID] [--dry-run] [--json] [--report FILE]
```
Runs the deterministic rules over the whole project and applies the