Exit Codes
What 0, 1, 2 and 3 mean when commitfence review ends, each with a real example.
On this page
The exit codes of review#
The hook, and a build pipeline, act on the exit code of commitfence review.
| Code | Meaning |
|---|---|
0 | The push may go. |
1 | A rule that blocks is broken. |
2 | The review could not be completed. |
3 | Wrong settings or a wrong command. |
A review never ends with 0 when it could not be finished.
0: the push may go#
Terminal
$ commitfence review --stagedShop (net11.0): reviewedstaged changes: 1 changed file. 1 of 1 files reviewed, 1 of 1 builds checked: 0 blocking, 0 warning.exit code 0
1: a rule that blocks is broken#
Terminal
$ commitfence review --pushsrc/Shop/Invoice.cs(7,9): error TEAM010: No braces around a single-line ifsrc/Shop/Invoice.cs(5,17): warning CA1822: Member 'IsOverdue' does not access instance data and can be marked as static [Shop, net11.0]src/Shop/Invoice.cs(7,28): error TEAM012: Use IClock, not DateTime.NowShop (net11.0): reviewedrefs/heads/main: 3 changed files. Rule files changed: .editorconfig, commitfence.json. 2 changed files of no known language were not looked at. 1 of 1 files reviewed, 1 of 1 builds checked: 2 blocking, 1 warning.exit code 1
2: the review could not be completed#
Here the revision does not exist, so there is nothing to review:
Terminal
$ commitfence review --base nonexistentrevreview scope: incomplete: 'nonexistentrev' is not a revision of this repositoryThe review is incomplete.exit code 2
3: wrong settings or a wrong command#
Terminal
$ commitfence review --files src/Shop/Invoice.cs --settings nothere.json<folder>\tour\nothere.json: The settings file does not exist.exit code 3
Terminal
$ commitfence rules add TEAM020 --for if-statement --title x --require nothing=1'nothing' is not a property of if-statement. Known properties: statementsInBody, bodyFitsOnOneLine, fitsOnOneLine, braces, isElseIf, hasElse, lines.exit code 3
The other commands end with 0 when they did what was asked, and with 3 when they were not understood or refused, as above.
Something wrong or unclear on this page? Tell us on GitHub