https://github.com/wemake-services/dotenv-linter
:relaxed: Linting dotenv files like a charm!
https://github.com/wemake-services/dotenv-linter
code-quality dotenv dotenv-parser linter linting
Last synced: 1 day ago
JSON representation
:relaxed: Linting dotenv files like a charm!
- Host: GitHub
- URL: https://github.com/wemake-services/dotenv-linter
- Owner: wemake-services
- License: mit
- Created: 2018-11-30T16:03:43.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-10T07:33:52.000Z (5 days ago)
- Last Synced: 2025-04-10T07:41:37.048Z (5 days ago)
- Topics: code-quality, dotenv, dotenv-parser, linter, linting
- Language: Python
- Homepage: https://dotenv-linter.rtfd.io
- Size: 1.44 MB
- Stars: 290
- Watchers: 6
- Forks: 9
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - Run dotenv-linter - Lints your .env files like a charm, with optional reviewdog output on the PR
- fucking-awesome-actions - Run dotenv-linter - Lints your .env files like a charm, with optional reviewdog output on the PR
- awesome-workflows - Run dotenv-linter - Lints your .env files like a charm, with optional reviewdog output on the PR
README
# dotenv-linter
[](https://wemake-services.github.io)
[](https://github.com/wemake-services/dotenv-linter/actions/workflows/test.yml)
[](https://codecov.io/gh/wemake-services/dotenv-linter)
[](https://github.com/wemake-services/dotenv-linter/actions?query=workflow%3Adotenv)
[](https://pypi.org/project/dotenv-linter/)
[](https://dotenv-linter.readthedocs.io/en/latest/?badge=latest)---
Simple linter for `.env` files.

While `.env` files are very simple it is required to keep them consistent.
This tool offers a wide range of consistency rules and best practices.And it integrates perfectly to any existing workflow.
Read [the announcing post](https://sobolevn.me/2019/01/announcing-dotenv-linter).
## Installation and usage
```bash
pip install dotenv-linter
```And then run it:
```bash
dotenv-linter .env .env.template
```See [Usage](https://dotenv-linter.readthedocs.io/en/latest/#usage)
section for more information.## Examples
There are many things that can go wrong in your `.env` files:
```ini
# Next line has leading space which will be removed:
SPACED=# Equal signs should not be spaced:
KEY = VALUE# Quotes won't be preserved after parsing, do not use them:
SECRET="my value"# Beware of duplicate keys!
SECRET=Already defined ;(# Respect the convention, use `UPPER_CASE`:
kebab-case-name=1
snake_case_name=2
```And much more! You can find the [full list of violations in our docs](https://dotenv-linter.readthedocs.io/en/latest/pages/violations/).
## Pre-commit hooks
`dotenv-linter` can also be used as a [pre-commit](https://github.com/pre-commit/pre-commit) hook.
To do so, add the following to the `.pre-commit-config.yaml` file at the root of your project:```yaml
repos:
- repo: https://github.com/wemake-services/dotenv-linter
rev: 0.2.0 # Use the ref you want to point at
hooks:
- id: dotenv-linter
```For the more detailed instructions on the pre-commit tool itself,
please refer to [its website](https://pre-commit.com/).## Gratis
Special thanks goes to [Ignacio Toledo](https://ign.uy)
for creating an awesome logo for the project.