MCPcopy Index your code
hub / github.com/dotenv-linter/dotenv-linter

github.com/dotenv-linter/dotenv-linter @v4.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v4.0.0 ↗ · + Follow
615 symbols 1,702 edges 104 files 49 documented · 8% updated 5mo agov4.0.0 · 2025-10-18★ 2,09014 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

dotenv-linter

⚡️Lightning-fast linter for .env files. Written in Rust 🦀

GitHub Actions Coverage Status License Releases

dotenv-linter can check / fix / diff .env files for problems that may cause the application to malfunction.

Available checks:

    ✅ Duplicated key

    ✅ Ending blank line

    ✅ Extra blank line

    ✅ Incorrect delimiter

    ✅ Key without value

    ✅ Leading character

    ✅ Lowercase key

    ✅ Quote character

    ✅ Schema violation

    ✅ Space character

    ✅ Substitution key

    ✅ Trailing whitespace

    ✅ Unordered key

    ✅ Value without quotes

What is a .env file?

    💡 A .env file or dotenv file is a simple text file containing all the environment variables of a project.

    Storing configuration in the environment variables is one of the tenets of the Manifesto of Twelve-Factor App.

    The .env file has a simple key-value format, for example: FOO=BAR.

    More information you can find in articles in English and Russian.

The key features:

    ⚡️ Lightning-fast because it is written in Rust 🦀

    💣 Can be used on any project regardless of the programming language 💥

    🚀 Can be integrated with reviewdog and other CI services (including GitHub Actions and Super-Linter) 🔥

Articles about dotenv-linter:

👨‍💻 Installation

Pre-compiled binary

```shell script

Linux / macOS / Windows (MINGW and etc). Installs it into ./bin/ by default

$ curl -sSfL https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s

Or a shorter way

$ curl -sSfL https://git.io/JLbXn | sh -s

Specify installation directory and version

$ curl -sSfL https://git.io/JLbXn | sh -s -- -b usr/local/bin v2.0.0

Alpine Linux (using wget)

$ wget -q -O - https://git.io/JLbXn | sh -s


You can find other installation methods here: https://dotenv-linter.github.io/#/installation

## 🚀 Usage

#### ✅ Check

`dotenv-linter` can check all `.env` files in the current directory:

```shell
$ dotenv-linter check .
Checking .env
.env:2 DuplicatedKey: The FOO key is duplicated
.env:3 UnorderedKey: The BAR key should go before the FOO key

Checking .env.test
.env.test:1 LeadingCharacter: Invalid leading character detected

Found 3 problems

🛠 Fix

It can also fix the found warnings with the fix command:

$ dotenv-linter fix .
Fixing .env
Original file was backed up to: ".env_1601378896"

.env:2 DuplicatedKey: The BAR key is duplicated
.env:3 LowercaseKey: The foo key should be in uppercase

All warnings are fixed. Total: 2

🤲 Diff

In addition, dotenv-linter can compare .env files with each other and output the difference between them:

$ dotenv-linter diff .env .env.example
Comparing .env
Comparing .env.example
.env is missing keys: BAR
.env.example is missing keys: FOO

Other use cases you can find on the documentation site (https://dotenv-linter.github.io):

🚦 Continuous Integration

dotenv-linter can also be used with CI services such as: GitHub Actions and Circle CI.

💻 Pre-commit

To run dotenv-linter as part of a pre-commit workflow, add something like the below to the repos list in the project's .pre-commit-config.yaml:

# .pre-commit-config.yaml

...
repos:
    ...
      - repo: https://github.com/dotenv-linter/dotenv-linter
      rev: 3.3.1
      hooks:
        - id: dotenv-linter
      ...

🚧 Benchmark

Benchmarking dotenv-linter/dotenv-linter and wemake-services/dotenv-linter has done using the hyperfine utility:

Command Mean [ms] Min [ms] Max [ms] Relative
dotenv-linter/dotenv-linter .env 2.7 ± 0.4 2.0 4.3 1.00
wemake-services/dotenv-linter .env 162.6 ± 12.1 153.0 201.3 60.83 ± 10.20

Content of .env file used for benchmarking

 SPACED=

KEY = VALUE

SECRET="my value"

SECRET=Already defined

kebab-case-name=1
snake_case_name=2

✌️ Mentorship

dotenv-linter is not just a linter for .env files — it is also a contributor-friendly open-source project with the purpose of helping others learn Rust using a simple, but useful tool. 😊

In addition to studying Rust, this project has another goal — to promote love for open-source, help you with the first steps in it and give an opportunity to contribute to the open-source project written in Rust. ❤️

We act as a mentor within this project and help developers follow the path of a novice contributor from start to the top. 🤗

🤝 Contributing

If you've ever wanted to contribute to open source, now you have a great opportunity:

👍 Similar projects

✨ Contributors

This project exists thanks to all the people who contribute. [Contribute].

♥️ Sponsors

dotenv-linter is created & supported by Evrone. What else we develop with Rust.

Sponsored by Evrone

Become a financial contributor and help us sustain our community.

📃 License

MIT

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 383
Method 175
Class 49
Enum 6
Interface 2

Languages

Rust100%

Modules by API surface

dotenv-core/src/lib.rs41 symbols
dotenv-analyzer/src/check/mod.rs38 symbols
dotenv-analyzer/src/fix/unordered_key.rs30 symbols
dotenv-cli/tests/common/test_dir.rs17 symbols
dotenv-analyzer/src/check/unordered_key.rs17 symbols
dotenv-analyzer/src/check/incorrect_delimiter.rs17 symbols
dotenv-finder/src/file.rs16 symbols
dotenv-analyzer/src/comment.rs14 symbols
dotenv-analyzer/src/check/leading_character.rs14 symbols
dotenv-analyzer/src/check/space_character.rs13 symbols
dotenv-cli/tests/output/fix.rs12 symbols
dotenv-cli/tests/output/check.rs12 symbols

For agents

$ claude mcp add dotenv-linter \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page