Running checks and autofix
Running checks
Run all enabled checks:
rev-dep config run
List every issue instead of the default truncated output:
rev-dep config run --list-all-issues
Can also run specific workspaces:
rev-dep config run --workspaces packages/app,packages/shared
Also lint the config for dead glob patterns while running (adds almost no time - it reuses the run's graph):
rev-dep config run --lint-config
This fails the run on any lint error and prints only the counts. See Linting the config for details.
Output formats
Information about the supported output formats can be found in Output formats.
Exit code
- Exit code
0when all enabled checks pass - Exit code
1when violations exist
Using AutoFix
Some checks can automatically apply fixes when both of these are true:
- the check supports autofix
- you run
rev-dep config run --fix
Fixable detectors
importConventionsunusedExportsDetectionorphanFilesDetection
Note that autofix: true must be set in the config for the detector be fixable.
Exit code nuance with --fix and --recheck
With --fix, the exit code is 0 when every issue found was fixable and has been fixed, and 1 when any issue remains that --fix cannot fix. This is the same in every output format. In JSON output, hasFailures still reports that the checks found issues before they were fixed.
--fix adjusts the source code but does not run the checks again afterwards. To validate the final state, use the --recheck flag in combination with --fix:
rev-dep config run --fix --recheck
An additional pass is performed after the fixes, and the output and exit code reflect the code as it is after fixing.
Autofixing orphan files issues
Note that autofixing orphan files issues removes the orphan file.
Removing one orphan file can cause another file to become orphan.
Running rev-dep config run --fix several times might be needed to remove all orphan files.
Updating the duplicated-code baseline
--fix never touches duplicated code - there is no edit a tool can safely make for you. The other thing config run can write is the snapshot: the committed file that records which duplications are already acknowledged.
rev-dep config run --update-snapshot
This rewrites every duplicatedCodeDetection that has a snapshotPath, so whatever this run found becomes the new baseline. Detections without one are unaffected.
Use it twice: once when adopting the check on a codebase that already has duplication, and again after you resolve some of it, so the baseline follows the code. See duplicated code.
Updating acknowledged findings
With top-level baselineSnapshotPath, rev-dep config run --update-snapshot records the current findings baseline and updates configured duplicated-code snapshots. See Findings baseline for setup, exact comparison, and the distinction between the two snapshot mechanisms. With a findings baseline, --fix always rechecks final code; use --fix --update-snapshot to fix and record the final state. Updating the general baseline requires all workspaces.