You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: exit code semantics for CI and git hook integration #1
Currently dupehound scan exits with code 0 regardless of whether clones are found or not. This makes it impossible to use as a git pre-commit hook or CI gate — tools that block on non-zero exit cannot act on the result.
The fix is straightforward: exit 1 when clones are detected, 0 when the codebase is clean, and 2 on a tool/configuration error. An escape hatch flag --exit-zero should be provided for reporting pipelines that should never fail the pipeline regardless of findings.
Exit code contract
Situation
Exit code
No clones found
0
Clones found
1
Tool error (bad path, invalid format, etc.)
2
--exit-zero flag present
always 0
Motivation
# pre-commit hook — blocks commit if duplicates exist
dupehound scan --path . --min-tokens 50
# exits 1 → commit blocked, developer sees the report# CI reporting step — never fails the pipeline, just reports
dupehound scan --path . --format json --output report.json --exit-zero
Implementation checklist
Core
actions/scan.go: return a typed sentinel error (e.g. ErrClonesFound) when report.TotalClones > 0
Activity
feat(#1): exit code semantics for CI and git hook integration
feat(#1): exit code semantics for CI and git hook integration (#7)