Description
It checks .env files for problems that may cause the application to malfunction:
✅Duplicated Key
✅Incorrect delimiter
✅Key without value
✅Leading character
✅Lowercase key
✅Quote character (Will be available in v2.0.0)
✅Space character
✅Unordered Key
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) 🔥
Articles about dotenv-linter:
dotenv-linter alternatives and similar libraries
Based on the "Code Analysis" category.
Alternatively, view dotenv-linter alternatives based on common mentions on social networks and blogs.
-
SonarQube
Integrates other analysis components via plugins and provides an overview of the metrics over time. -
Codacy
Continuous static analysis, code coverage, and software metrics to automate code reviews.
Get performance insights in less than 4 minutes
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of dotenv-linter or a related project?
README
⚡️Lightning-fast linter for .env files. Written in Rust 🦀
It checks .env
files for problems that may cause the application to malfunction:
✅ Duplicated Key
✅ Ending Blank Line
✅ Extra Blank Line
✅ Incorrect delimiter
✅ Key without value
✅ Leading character
✅ Lowercase key
✅ Quote character
✅ Space character
✅ Trailing whitespace
✅ Unordered Key
And automatically fixes them all 😱
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) 🔥
Articles about dotenv-linter:
Dotenv-linter is created & supported by Evrone. What else we develop with Rust.
👨💻 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
Specify installation directory and version
$ curl -sSfL https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s -- -b usr/local/bin v2.0.0
Alpine Linux (wget)
$ wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s
You can find other installation methods here: https://dotenv-linter.github.io/#/installation
## 🚀 Usage
By default, `dotenv-linter` checks all `.env` files in the current directory:
```shell script
$ dotenv-linter
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
It can also fix found warnings. You should use the argument --fix
(or its short version -f
) for this:
```shell script $ dotenv-linter -f 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
Other use cases you can find here: https://dotenv-linter.github.io/#/usage
## 🚦 Continuous Integration
`dotenv-linter` can also be used with CI services such as: [GitHub Actions](https://dotenv-linter.github.io/#/ci/github_actions) and [Circle CI](https://dotenv-linter.github.io/#/ci/circleci).
## 🚧 Benchmark
Benchmarking [dotenv-linter/dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) and [wemake-services/dotenv-linter](https://github.com/wemake-services/dotenv-linter) has done using the [hyperfine](https://github.com/sharkdp/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 |
<details>
<summary>Content of <code>.env</code> file used for benchmarking</summary>
```dotenv
SPACED=
KEY = VALUE
SECRET="my value"
SECRET=Already defined
kebab-case-name=1
snake_case_name=2
🤝 Contributing
If you've ever wanted to contribute to open source, now you have a great opportunity:
👍 Similar projects
- wemake-services/dotenv-linter (Python)
✨ Contributors
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
♥️ Sponsors
Become a financial contributor and help us sustain our community.
📃 License
*Note that all licence references and agreements mentioned in the dotenv-linter README section above
are relevant to that project's source code only.