Repository navigation
Read the STRICT environment variable in the command-line tool - #202
Open
anubhavlal07 wants to merge 1 commit into
Open
anubhavlal07 wants to merge 1 commit into
anubhavlal07 wants to merge 1 commit into
Conversation
Owner
|
Are you using STRICT? It's probably almost never the right thing to do. |
Author
|
Not personally. I noticed the command-line tool ignored the |
Owner
|
Well I'd rather not waste my time on reviewing PRs that no one needs. When it becomes a regular thing it's making an impact on my ability to do meaningful work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The command-line tool (
python -m email_validator) says that keyword arguments tovalidate_emailcan be set with environment variables of the same name in upper case. It reads every boolean option that way exceptstrict. SoSTRICT=true python -m email_validator <address>ignored the variable and never ran the strict local-part length check.Fix: add
STRICTto the list of boolean environment variables inemail_validator/__main__.py. It is parsed like the other options, sofalse/0/no/off/empty mean off.Tests: added
test_main_strict_from_envintests/test_main.py, which passes a 65-character local part withSTRICTset and expects the "too long before the @-sign" error. It fails onmain, where the address is accepted and printed as JSON, and passes with the fix. flake8 is clean. The full suite (pytest -k "not network") gives 345 passed and 1 failed:test_syntax.py::test_domain_literal, which fails the same way on unmodifiedmainin my environment. mypy has the same 2 errors intypes.pyas onmain.