Exit Codes
FSH Lint uses specific exit codes to indicate different outcomes.
Exit Code Reference
Section titled “Exit Code Reference”0
- Success
Section titled “0 - Success”No errors found. May contain warnings or hints.
fsh-lint lint file.fshecho $? # 0
1
- Lint Errors
Section titled “1 - Lint Errors”Lint errors were found in the files.
fsh-lint lint invalid.fshecho $? # 1
2
- Invalid Configuration
Section titled “2 - Invalid Configuration”Configuration file is invalid or malformed.
fsh-lint lint --config invalid.json *.fshecho $? # 2
3
- File Not Found
Section titled “3 - File Not Found”Specified files or directories not found.
fsh-lint lint nonexistent.fshecho $? # 3
4
- Invalid Arguments
Section titled “4 - Invalid Arguments”Invalid command-line arguments provided.
fsh-lint lint --unknown-flag *.fshecho $? # 4
5
- Internal Error
Section titled “5 - Internal Error”An internal error occurred.
# Should not happen in normal useecho $? # 5
CI/CD Integration
Section titled “CI/CD Integration”Use exit codes in CI/CD pipelines:
GitHub Actions
Section titled “GitHub Actions”- name: Lint FSH files run: | fsh-lint lint **/*.fsh if [ $? -eq 1 ]; then echo "Lint errors found" exit 1 fi
GitLab CI
Section titled “GitLab CI”lint: script: - fsh-lint lint **/*.fsh allow_failure: false
Jenkins
Section titled “Jenkins”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 ''' }}
Warning-Only Mode
Section titled “Warning-Only Mode”Treat warnings as errors for stricter CI:
fsh-lint lint --severity warn **/*.fsh
This will exit with code 1
if any warnings are found.
Ignoring Specific Exit Codes
Section titled “Ignoring Specific Exit Codes”Continue on warnings but fail on errors:
fsh-lint lint **/*.fsh || [ $? -eq 0 -o $? -eq 1 ] && echo "OK"