Feature request: option that completely disallows typing.cast
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature
An option that disallows use of typing.cast, eg --disallow-casts
Pitch
cast() gets around static type safety without ensuring dynamic type correctness. Sometimes you have to use it—you know how it is—but it's not ideal. (For instance, mypy documentation seems to imply the main use of cast is when the typechecker or type annotations aren't quite good enough.) That means, in my opinion, cast is a great candidate to have a option disallowing its use, to ensure code quality in codebases where it is not needed.
I also think this option should be enabled in strict mode, but I suspect other people might disagree.
This proposal is distinct from the --warn-redundant-casts option that already exists, but is somewhat similar.
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, zu überprüfen, wie die bestehende --warn-redundant-casts-Option implementiert ist, und lies die Diskussion darüber, ob dies in den strict mode gehört. Lege fest, wie typing.cast behandelt werden soll und wie sich die Konfiguration verhält, und überprüfe anschließend, dass die neue Option Casts ablehnt und dass das gewählte Verhalten im strict mode durch Tests abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100