Automattic / Automattic/VIP-Coding-Standards

Audit Public Sniff Properties

Đang mở
#234 7 bình luận 0 reaction 0 người được giao Xem trên GitHub
Type: Maintenance
Ngôn ngữ chính
PHP
Star
261
Fork
44
Merge trung bình
19 phút
Pull request đã merge (30 ngày)
1

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Rà soát 47 thuộc tính public trong các lớp sniff, bắt đầu với VIP override trong .phpcs.xml.dist và danh sách liên kết của các instance nếu có. Với mỗi thuộc tính, hãy xác định thuộc tính đó được dự định là configurable hay private, đồng thời ghi lại hướng dẫn về các thuộc tính configurable trên trang wiki Custom properties for VIPCS Sniffs. Được coi là hoàn tất khi các thuộc tính phù hợp là private, các thuộc tính còn lại được ghi thành tài liệu và tác động của bản release có breaking change đã được xử lý.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
php
Lĩnh vực
documentation, tooling
Loại issue
Tái cấu trúc
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.