Automattic / Automattic/VIP-Coding-Standards
Audit Public Sniff Properties
- Vorherrschende Sprache
- PHP
- Sterne
- 261
- Forks
- 44
- Ø Merge
- 19 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
## What problem would the enhancement address for VIP?
There are 47 instances of public properties within sniff classes. Public properties allow changing sniff behaviour by customising a ruleset by passing different types of values via the ruleset. VIP [uses](https://github.com/Automattic/VIP-Coding-Standards/blob/918b0ca0fe986ae58babd77c7ab5e0ff7a6f7eb5/.phpcs.xml.dist#L29) itself to adjust how a WPCS sniff runs.
However, I suspect that some of the instances are NOT meant to be changed - whitelisted Batcache params, restricted constant names and declarations, etc.
## Describe the solution you'd like
Audit the uses and convert to `private` where suitable. Document the rest on a [wiki page](https://github.com/Automattic/VIP-Coding-Standards/wiki/Custom-properties-for-VIPCS-Sniffs).
I'll create a linked list of the 47 instances, possibly along with who added them, to check if they are meant to be public or not.
For those that are meant to be changeable, then a better approach for some cases is to have a private default list of values, and then a public custom list, and the two lists merged together - that way, the custom rulesets don't need to also add in the default values as well.
## Additional context
Note that this would technically be a breaking change, since it is possible that someone was already making use of these unintentional public properties in their own rulesets. As such, this would require a bump from `0.y.z` to `0.y+1.0`, or a normal major release if `1.0.0` has been released in the meantime.
Beitragsleitfaden
Rechercherichtung
Überprüfe die 47 öffentlichen Eigenschaften in den Sniff-Klassen, beginnend mit dem VIP-Override in .phpcs.xml.dist und, sofern verfügbar, der verknüpften Instanzliste. Bestimme für jede Eigenschaft, ob sie konfigurierbar oder privat sein soll, und dokumentiere die Richtlinien für konfigurierbare Eigenschaften auf der Wiki-Seite Custom properties for VIPCS Sniffs. Erledigt bedeutet, dass geeignete Eigenschaften privat sind, die übrigen Eigenschaften dokumentiert sind und die Auswirkungen des Releases mit Breaking Change berücksichtigt sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php
- Bereich
- documentation, tooling
- Issue-Typ
- Refactoring
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100