Mypy Does Not Return Non-Zero Exit Code for Invalid mypy.ini Values Followed by Comments, including 'strict'
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Verhalten mit der bereitgestellten mypy.ini-Konfiguration zu reproduzieren, und verfolge den Einstiegspunkt für die Konfigurationsanalyse und -validierung von mypy. Füge Abdeckung für einen booleschen Wert gefolgt von einem Kommentar hinzu, und überprüfe, dass ungültige Werte einen Exit-Code ungleich null erzeugen, während gültige Werte unverändert bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 58/100