Automattic / Automattic/VIP-Coding-Standards
File inclusion - check for constant defined in the current file
- 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?
The frequency with which "Warning: File inclusion using custom constant (`PREFIX_PATH`). Probably needs manual inspection (WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant)." shows up just below a line that matches the pattern is high.
Perhaps we can reduce this noise.
## Describe the solution you'd like
See if we can improve the sniff, to see if the constant has been defined in the current file, and if so, skip the violation.
## What code should be reported as a violation?
```php
require PREFIX_PATH_UNDEFINED_IN_THIS_FILE . '/...';
```
## What code should *not* be reported as a violation?
```php
define( 'PREFIX_PATH_DEFINED_IN_THIS_FILE', '...' );
...other code...
require PREFIX_PATH_DEFINED_IN_THIS_FILE . '/...';
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tìm sniff phát ra WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant và kiểm tra cách nó phát hiện các hằng số trong các biểu thức đưa tệp vào. Bổ sung coverage cho ví dụ về hằng số chưa được định nghĩa và hằng số được định nghĩa trước đó trong cùng tệp; hoàn thành khi chỉ trường hợp chưa được định nghĩa được báo cáo.
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
- tooling
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- 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
- 45/100