Bug description
When pylint loads its configuration from a .toml file, it treats the mere presence of a key as enabling that flag or option, without regard to its actual value.
For instance, setting from-stdin = false in a toml config will cause pylint to attempt to read from stdin. Setting exit-zero = false will cause pylint to always exit with code 0 even if there are errors or warnings.
The only way to disable the flag is to comment out the line. This is directly at odds with the example configuration provided in the documentation (https://pylint.readthedocs.io/en/latest/user_guide/configuration/all-options.html) which has many examples of option = false.
This same behavior seems to happen with pylintrc configuration files as well, but I only did some basic testing.
Configuration
# example 1:
[tool.pylint.main]
from-stdin = false
exit-zero = false
# example 2:
[tool.pylint.main]
# from-stdin = false
exit-zero = false
# example 3:
[tool.pylint.main]
# from-stdin = false
# exit-zero = false
Command used
# test.py
import datetime
Pylint output
# example 1
# hangs because it is expecting input from stdin ... must be killed with ctrl-c
# example 2
************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:1:0: W0611: Unused import datetime (unused-import)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
0
# example 3
************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:1:0: W0611: Unused import datetime (unused-import)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
20
Expected behavior
Examples 1 and 2 should produce the same output as example 3
Pylint version
pylint 2.17.0
astroid 2.15.0
Python 3.7.3 (default, Oct 31 2022, 14:04:00)
[GCC 8.3.0]
OS / Environment
Debian 10
Additional dependencies
None
Bug description
When pylint loads its configuration from a .toml file, it treats the mere presence of a key as enabling that flag or option, without regard to its actual value.
For instance, setting
from-stdin = falsein a toml config will cause pylint to attempt to read from stdin. Settingexit-zero = falsewill cause pylint to always exit with code 0 even if there are errors or warnings.The only way to disable the flag is to comment out the line. This is directly at odds with the example configuration provided in the documentation (https://pylint.readthedocs.io/en/latest/user_guide/configuration/all-options.html) which has many examples of
option = false.This same behavior seems to happen with pylintrc configuration files as well, but I only did some basic testing.
Configuration
Command used
Pylint output
Expected behavior
Examples 1 and 2 should produce the same output as example 3
Pylint version
OS / Environment
Debian 10
Additional dependencies
None