Bug Report
Description
When using a comment in an mypy.ini file, it interferes with the parsing of boolean values, leading to unintended behavior. Specifically, if a boolean value is followed by a comment, mypy does not return a non-zero exit code, even if the value is invalid. This can lead to unexpected configuration changes and, in the example provided, turns off the 'strict' mode.
To Reproduce
[mypy]
strict = true # this comment turns strict off
Expected Behavior
Mypy should return a non-zero exit code when encountering invalid configuration values, even if they are followed by a comment.
Actual Behavior
Mypy outputs a warning but does not return a non-zero exit code, allowing the invalid configuration to take effect.
mypy.ini: [mypy]: strict: Not a boolean: true # this comment turns strict off
Your Environment
- Mypy version used: 1.7.0, 1.8.0
- Mypy command-line flags: ''
- Mypy configuration options from
mypy.ini (and other config files): n/a
- Python version used: Python 3.10.11