envcheck lint

Lint .env files for common issues.

Usage

envcheck lint [OPTIONS] [FILES]...

Arguments

  • <FILES>... - One or more .env files to lint

Options

OptionDescription
-f, --format <FORMAT>Output format: text, json, github, sarif
-q, --quietSuppress output, use exit codes
-i, --ignore <RULES>Comma-separated list of rules to ignore
--fixAuto-fix issues (alias for envcheck fix)
-h, --helpPrint help

Exit Codes

CodeMeaning
0No issues found
1Errors found
2Warnings only (no errors)

Examples

Lint single file

envcheck lint .env

Lint multiple files

envcheck lint .env .env.local .env.prod

JSON output

envcheck lint .env --format=json

GitHub Actions format

envcheck lint .env --format=github

Output:

::error file=.env,line=5,col=1::E001: Duplicate key: DATABASE_URL
::warning file=.env,line=12,col=1::W001: Empty value: DEBUG_MODE

Ignore specific rules

envcheck lint .env --ignore=W001,W002

Detected Issues

The lint command detects the following:

CodeRuleSeverityDescription
E001Duplicate KeyErrorKey defined multiple times
E002Invalid SyntaxErrorLine is not valid KEY=VALUE
W001Empty ValueWarningKey has no value assigned
W002Trailing WhitespaceWarningLine ends with whitespace
W003Unsorted KeysInfoKeys not in alphabetical order

See Also