Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
layout title description date tags republished
Announcing dotenv-linter
Simple linter for `.env` files. While `.env` files are pretty straight-forward it is required to keep them consistent. This tool offers a wide range of consistency rules and best practices. And it integrates perfectly into any existing workflow.

I happy to announce a simple yet very useful tool to lint your .env files.

dotenv-linter logo


As a part of our "not blaming but fixing" corporate culture we build a lot of tools that prevent us from making the same mistakes over and over again.

dotenv-linter is one of these tools.

Some time ago we had several problems with .env files:

  • Some developers used CONSTANT_CASE for variable names and some developers used snake_case for that. While this is not a technical issue, but it is not very practical to mix these two cases and then think: what case I have used for this particular variable? Consistency is important!
  • We also had a problem with quotes and extra spaces. Some developers used KEY=VALUE and some used KEY = "VALUE" while in fact, these two examples will resolve in exactly the same thing - we prefer to have one-- and preferably only one --obvious way to do it. So, we now stick to KEY=VALUE notation
  • We also once had a duplicate key that ruined my day. I have spent several hours debugging my app because of this simple issue. That was a turning point for me and I have decided: let's automate it!


You can install it via pip (or any other similar tool):

$ pip install dotenv-linter

Why pip? Because python is present almost on all Linux setups. And we try to make this tool as portable as possible.


Usage is really simple:

$ dotenv-linter path/to/your/.env even/multiple/files/are/fine/.env

Real-life examples

If you are interested in how we use it real life applications you can have a look at (and even try!) our django template. Here's the line that invokes it.

We also have a full list of linting rules in our docs, check it out.


I hope this simple tool will save you some time, make your project more consistent, and your life slightly better. Add me on github to stay informed about the tools I am building!