Preventing code quality regressions
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 5.1k
- Forks
- 2.1k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 82
Beschreibung
For some time now we've used pyright's stricter configuration to prevent code quality regressions. Unless a stubs package is mentioned in the config file, it's expected to have annotations for all its fields. While this has served us well for a while, it has become unsuitable since the introduction of _typeshed.Incomplete:
- pyright doesn't understand that a (partial)
Incompleteannotation is equivalent (for our purposes) to an unannotated item. - It's tedious to maintain the pyright stricter configuration in addition to the metadata in the stubs directory.
- It's easy to cheat the regression check by using
Incomplete.
To improve the situation, I propose to move to a custom solution:
- Add an
incompletemarker toMETADATA.toml(defaulting tofalse). - Add a custom script to CI that checks that a stub package marked as complete can't have any incomplete (unannotated or using
Incomplete) fields. Alternatively, we could add a disabled-by-default check to flake8-pyi and use that instead. - At a later date, we could also add a PR CI script that add a PR comment warning a user if the amount of incomplete increases due to a PR.
(See also https://alexwaygood.github.io/typeshed-stats/.)
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 mit der Durchsicht der Stub-Paketmetadaten in METADATA.toml und der aktuellen CI-Prüfungen, die die strengere Konfiguration von pyright verwenden. Vergleiche die Implementierung eines benutzerdefinierten CI-Skripts mit der vorgeschlagenen standardmäßig deaktivierten Prüfung flake8-pyi. Als abgeschlossen gilt die Aufgabe, wenn vollständige Pakete keine unannotierten Felder oder Felder mit _typeshed.Incomplete enthalten können und die Markierung für Unvollständigkeit standardmäßig auf false gesetzt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- ci-cd, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100