Skip to content

Exit Codes

FSH Lint uses specific exit codes to indicate different outcomes.

No errors found. May contain warnings or hints.

Terminal window
fsh-lint lint file.fsh
echo $? # 0

Lint errors were found in the files.

Terminal window
fsh-lint lint invalid.fsh
echo $? # 1

Configuration file is invalid or malformed.

Terminal window
fsh-lint lint --config invalid.json *.fsh
echo $? # 2

Specified files or directories not found.

Terminal window
fsh-lint lint nonexistent.fsh
echo $? # 3

Invalid command-line arguments provided.

Terminal window
fsh-lint lint --unknown-flag *.fsh
echo $? # 4

An internal error occurred.

Terminal window
# Should not happen in normal use
echo $? # 5

Use exit codes in CI/CD pipelines:

- name: Lint FSH files
run: |
fsh-lint lint **/*.fsh
if [ $? -eq 1 ]; then
echo "Lint errors found"
exit 1
fi
lint:
script:
- fsh-lint lint **/*.fsh
allow_failure: false
stage('Lint') {
steps {
sh '''
fsh-lint lint **/*.fsh
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
echo "Linting failed with code $EXIT_CODE"
exit $EXIT_CODE
fi
'''
}
}

Treat warnings as errors for stricter CI:

Terminal window
fsh-lint lint --severity warn **/*.fsh

This will exit with code 1 if any warnings are found.

Continue on warnings but fail on errors:

Terminal window
fsh-lint lint **/*.fsh || [ $? -eq 0 -o $? -eq 1 ] && echo "OK"