Lint .env files for common issues.
envcheck lint [OPTIONS] [FILES]...
<FILES>... - One or more .env files to lint| Option | Description |
|---|---|
-f, --format <FORMAT> | Output format: text, json, github, sarif |
-q, --quiet | Suppress output, use exit codes |
-i, --ignore <RULES> | Comma-separated list of rules to ignore |
--fix | Auto-fix issues (alias for envcheck fix) |
-h, --help | Print help |
| Code | Meaning |
|---|---|
| 0 | No issues found |
| 1 | Errors found |
| 2 | Warnings only (no errors) |
envcheck lint .env
envcheck lint .env .env.local .env.prod
envcheck lint .env --format=json
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
envcheck lint .env --ignore=W001,W002
The lint command detects the following:
| Code | Rule | Severity | Description |
|---|---|---|---|
| E001 | Duplicate Key | Error | Key defined multiple times |
| E002 | Invalid Syntax | Error | Line is not valid KEY=VALUE |
| W001 | Empty Value | Warning | Key has no value assigned |
| W002 | Trailing Whitespace | Warning | Line ends with whitespace |
| W003 | Unsorted Keys | Info | Keys not in alphabetical order |