diff options
author | Tushar Sadhwani <tushar.sadhwani000@gmail.com> | 2021-11-13 02:51:09 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-12 22:21:09 +0100 |
commit | 7976857b94146f6ad81ade63797905cd662238c2 (patch) | |
tree | 8301ad4ef0375fd292e5eea8f364d227c1c25a4f | |
parent | c62738b66bcbe7220624b04192e9cfe6820ed13a (diff) | |
download | pylint-git-7976857b94146f6ad81ade63797905cd662238c2.tar.gz |
Make y/n validator case insensitive (#5294)
* Make y/n validator case insensitive
* Add changelog entry
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | doc/whatsnew/2.12.rst | 2 | ||||
-rw-r--r-- | pylint/config/option.py | 2 |
3 files changed, 6 insertions, 0 deletions
@@ -158,6 +158,8 @@ Release date: TBA Closes #5208 +* Make yn validator case insensitive, to allow for ``True`` and ``False`` in config files. + What's New in Pylint 2.11.2? ============================ diff --git a/doc/whatsnew/2.12.rst b/doc/whatsnew/2.12.rst index 76b08846f..919371046 100644 --- a/doc/whatsnew/2.12.rst +++ b/doc/whatsnew/2.12.rst @@ -156,3 +156,5 @@ Other Changes have functioning shared semaphore implementation. Closes #5216 + +* Make yn validator case insensitive, to allow for ``True`` and ``False`` in config files. diff --git a/pylint/config/option.py b/pylint/config/option.py index 7b3e3b1b1..706b7a4af 100644 --- a/pylint/config/option.py +++ b/pylint/config/option.py @@ -50,6 +50,8 @@ def _choice_validator(choices, name, value): def _yn_validator(opt, _, value): if isinstance(value, int): return bool(value) + if isinstance(value, str): + value = value.lower() if value in ("y", "yes", "true"): return True if value in ("n", "no", "false"): |