Severity: Error | Category: Linting
Detects lines that don't follow the KEY=VALUE format expected in .env files.
| Format | Example | Valid |
|---|---|---|
| Simple assignment | KEY=value | ✅ |
| With spaces in value | KEY=value with spaces | ✅ |
| Quoted value | KEY="quoted value" | ✅ |
| Empty value | KEY= | ⚠️ (W001) |
| Comment | # This is a comment | ✅ |
| Empty line | (blank) | ✅ |
# Missing equals sign
DATABASE_URL postgres://localhost
# Invalid characters in key
123INVALID=value
MY-KEY=value # hyphens not recommended
# Invalid escape sequence
KEY=value\nmore
DATABASE_URL=postgres://localhost
INVALID_123=value
MY_KEY=value # Use underscores
KEY="value\nmore" # Quote for escapes
Valid keys:
SCREAMING_SNAKE_CASE$ envcheck lint .env
.env:8: E002: Invalid syntax: 'DATABASE_URL postgres://localhost'
# .envcheckrc.yaml
rules:
E002:
severity: error
allow_hyphens: false # Set true to allow MY-KEY