paint-brush
Find and Fix Problems in .env Files With Dotenv-linter v2.2.0by@iurii-gurzhii

Find and Fix Problems in .env Files With Dotenv-linter v2.2.0

by Iurii GurzhiiOctober 20th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

We have developed dotenv-linter — a useful tool for checking.env files. It helps to find problems in.env files that you might miss at first, but which later may result in incorrect work of applications. We have made the tool universal, it can be connected to any project regardless of the programming language. The ability to install the latest. version from the repository via Homebrew was added: The. ability to use Homebrew has been added to the new v2.2.0 release.
featured image - Find and Fix Problems in .env Files With Dotenv-linter v2.2.0
Iurii Gurzhii HackerNoon profile picture

We have developed dotenv-linter — a useful tool for checking .env files. It helps to find problems in .env files that you might miss at first, but which later may result in incorrect work of applications.

We have made the tool universal, it can be connected to any project regardless of the programming language.

We've just released a new version of dotenv-linter — v2.2.0, and here is an overview of the key changes included in this release!

Fixing warnings 🔥

Previously, dotenv-linter could only find problems in .env files:

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

Now, it can fix them right away with the new --fix/-f argument:

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

.env:2 DuplicatedKey: The FOO key is duplicated
.env:3 UnorderedKey: The BAR key should go before the FOO key

All warnings are fixed. Total: 2

Making a backup 💪

Fixing problems in .env files is cool, but dotenv-linter creates a backup for each of the files, just in case. You can enable this feature, or disable it using the --no-backup argument — it's up to you:

$ dotenv-linter --fix --no-backup

.env:2 DuplicatedKey: The FOO key is duplicated
.env:3 UnorderedKey: The BAR key should go before the FOO key

All warnings are fixed. Total: 2

Support for control comments 🕹

Previously, checks could be disabled globally using the --skip/-s argument:

$ dotenv-linter --skip UnorderedKey EndingBlankLine
.env:2 DuplicatedKey: The FOO key is duplicated

Found 1 problem

Displaying the total number of problems 👀

When checking several .env files, there was often not enough information provided about how many problems had been found in all files. We have added this information:

$ dotenv-linter
.env:2 DuplicatedKey: The FOO key is duplicated
.env:3 UnorderedKey: The BAR key should go before the FOO key
.env.test:1 LeadingCharacter: Invalid leading character detected

Found 3 problems

We have also added the new argument --quiet/-q to disable this:

$ dotenv-linter --quiet
.env:2 DuplicatedKey: The FOO key is duplicated
.env:3 UnorderedKey: The BAR key should go before the FOO key
.env.test:1 LeadingCharacter: Invalid leading character detected

Installing the latest version from the repository 🍺

The ability to install the latest version from the repository via Homebrew was added:

$ brew install --HEAD dotenv-linter/tap/dotenv-linter

These are all the key changes in the project that were included in the new v2.2.0 release. More information you can find in the changelog: v2.2.0.

https://github.com/dotenv-linter/dotenv-linter

This release wouldn't have been possible without the help of 19 talented developers! How can you support the project? It's very simple - just give us a star on GitHub.

Dotenv-linter is not just a linter for .env files — it is also a 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 on Rust.

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