Automattic / Automattic/VIP-Coding-Standards

Audit Public Sniff Properties

オープン
#234 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: Maintenance
主要言語
PHP
スター
261
フォーク
44
平均マージ
19分
マージ済み PR(30日)
1

説明

## 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

sniff クラスにある47個の public プロパティを確認する。まず .phpcs.xml.dist の VIP override から始め、利用可能な場合はインスタンスのリンクリストも確認する。各プロパティについて、configurable にする想定か private にする想定かを判断し、configurable プロパティに関する指針を wiki ページ Custom properties for VIPCS Sniffs に記録する。適切なプロパティが private になり、残りのプロパティが文書化され、breaking change を伴うリリースへの影響が対処されていれば完了とする。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
documentation, tooling
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。