Automattic / Automattic/VIP-Coding-Standards

Add warning for list_files function and related

Đang mở
#704 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Type: Enhancement
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?

I've recently been doing a code review and noticed the `list_files` function had no warning attached. On VIP Filesystem, the `list_files`, `scandir`, `opendir` will return empty result sets or false, so we should probably highlight this to customers to avoid unexpected results.

## Describe the solution you'd like
A warning should be added when the following functions are coded:
- list_files - WP
- scandir - PHP
- opendir - PHP

## What code should be reported as a violation?

```
$files = list_files( $folder, 2 );
```

## What code should *not* be reported as a violation?

## Additional context

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

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

Hướng nghiên cứu

Tìm các quy tắc PHP_CodeSniffer hiện có cho việc kiểm tra các hàm dành riêng cho WordPress và VIP, sau đó xem lại cách các cảnh báo được định nghĩa và kiểm thử. Xác nhận hành vi cảnh báo mong đợi đối với list_files, scandir và opendir, bao gồm ví dụ list_files được cung cấp; hoàn thành có nghĩa là các lệnh gọi đó được báo cáo một cách nhất quán.

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
35/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.