Ignoring violations¶
You can suppress specific violations directly in your .env file
using special ignore comments.
Syntax¶
Add a comment above the line you want to ignore:
# dotenv:ignore[ViolationName]
KEY=VALUE
You can also ignore multiple violations at once:
# dotenv:ignore[IncorrectNameViolation, SpacedValueViolation]
KEY=VALUE
And you can stack multiple ignore comments:
# dotenv:ignore[IncorrectNameViolation]
# dotenv:ignore[SpacedValueViolation]
KEY=VALUE
Example¶
# dotenv:ignore[IncorrectNameViolation]
wemake=DOTENV
# dotenv:ignore[UnreadableNameViolation]
MY_1I_VAR=VALUE
# dotenv:ignore[SpacedAssignViolation]
KEY =
# dotenv:ignore[ReservedNameViolation]
DJANGO_ENV=1
# dotenv:ignore[DuplicateNameViolation]
KEY=VALUE
# dotenv:ignore[DuplicateNameViolation]
KEY=VALUE
Ignore violations for blocks¶
You can also suppress violations across a block of lines:
# dotenv:disable[IncorrectNameViolation, SpacedNameViolation]
# This and the following lines are not checked for ``SpacedNameViolation`` and ``IncorrectNameViolation``
KEY=VALUE
SOME_KEY=VALUE
If you need to ignore all violations, you can use the # dotenv:disable comment:
# dotenv:disable
# This and the following lines are not checked for all violations
KEY=VALUE
SOME_KEY=VALUE
Then if you need to enable all violations, you can use the # dotenv:enable comment:
# dotenv:disable
# This and the following lines are not checked for all violations
KEY=VALUE
SOME_KEY=VALUE
# dotenv:enable
# This and the following lines are checked for all violations
DJANGO_ENV=VALUE
API_KEY=VALUE
If you need to ignore some lines, you can use the # dotenv:ignore comment:
# dotenv:enable
KEY1=VALUE
KEY2=VALUE
# dotenv:ignore[IncorrectNameViolation]
KEY3=VALUE
You can also enable only specific violations:
# dotenv:disable
KEY=VALUE
SOME_KEY=VALUE
# dotenv:enable[IncorrectNameViolation]
SOME_OTHER_KEY=VALUE