Skip to main content

Linting dotenv files like a charm!

Project description

dotenv-linter Build Status codecov Github Action Python Version Documentation Status

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.

Installation and usage

pip install dotenv-linter

And then run it:

dotenv-linter .env .env.template

See Usage section for more information.


There are many things that can go wrong in your .env files:

# Next line has leading space which will be removed:

# Equal signs should not be spaced:

# 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`:

And much more! You can find the full list of violations in our docs.

Pre-commit hooks

dotenv-linter can also be used as a pre-commit hook. To do so, add the following to the .pre-commit-config.yaml file at the root of your project:

  - repo:
    rev: 0.2.0  # Use the ref you want to point at
      - id: dotenv-linter

For the more detailed instructions on the pre-commit tool itself, please refer to its website.


Special thanks goes to Ignacio Toledo for creating an awesome logo for the project.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotenv-linter-0.4.0.tar.gz (16.0 kB view hashes)

Uploaded source

Built Distribution

dotenv_linter-0.4.0-py3-none-any.whl (22.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page