Add opt-in .distignore exclusions for local and CI scans
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, php, wordpress
- Lĩnh vực
- cli, documentation, frontend, testing-qa, tooling
Hướng nghiên cứu
Start by reading the proposed Dist_Ignore_Utility and the existing Ignore_Matcher, then inspect the Admin template/JavaScript/AJAX flag and the wp plugin check CLI entry point. The issue identifies PHPUnit tests with a fixture plugin, a Behat scenario, and docs/CLI.md as relevant work. Done means the opt-in .distignore checkbox and --use-distignore flag work as specified, while scans remain unchanged unless explicitly enabled.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Add an opt-in, off-by-default option to exclude the files and directories listed in a plugin's .distignore from a local or CI scan: a checkbox under Custom Exclusions in the Admin scanner, and --use-distignore for wp plugin check. It works like the existing .pcpignore option (#1460), but reads the file most plugins already keep for wp dist-archive.
I'd like to know whether this fits before opening a PR. The implementation is ready and passing CI on my fork, linked below.
Problem
When Plugin Check runs against a development checkout, it reports problems in files that never reach WordPress.org: test suites, build scripts, CI configuration, dotfiles, local release folders. The real findings get lost among them. On a typical plugin checkout, much of the report can come from tests/, bin/, scripts/ or local build folders, all of which the plugin's .distignore already keeps out of the zip.
#1460 solved this with .pcpignore. But a plugin that already builds its zip with wp dist-archive has to keep the same list in two files, and the two drift apart: a new dev folder added to .distignore but not to .pcpignore shows up in the scan again, and one added only to .pcpignore still ships.
Addressing the concerns from #692
I've read #692 and the discussion on #1181, and designed this around those points:
- Never automatic. Nothing reads
.distignoreunless the user asks. The Admin checkbox is unchecked by default and is shown only when the selected plugin has a.distignorefile. The CLI flag defaults to off. WordPress.org scans, which never pass the option, still inspect every file, as @davidperezgar asked on #1181. - "It may give a false sense of safety." The user has to opt in on every run, the same trade-off already accepted for
.pcpignore. It's for checking your working tree the way the zip will look, not a replacement for scanning the final zip. - "
.distignoreisn't a standard." That's true, but it's the filewp dist-archive(WP-CLI's own packaging command) reads, and it's common across WordPress plugins. The option uses the same.gitignoreruleswp dist-archivedoes, so the scan matches what the zip actually leaves out.
Proposed behaviour
- Admin: an "Exclude files listed in .distignore" checkbox under Custom Exclusions, visible only when the selected plugin has a
.distignorefile. Switching to a plugin without one hides it and unchecks it. - CLI:
wp plugin check <plugin> --use-distignore. - Matching follows
.gitignore, likewp dist-archive: a pattern containing a slash (other than a trailing one) is anchored to the plugin root, a pattern without one matches at any depth, a trailing slash means directory only,*and?never match a slash,**matches any number of directories, and a leading!re-includes a path. - Implementation: patterns are resolved against the plugin's files once, and each match becomes a literal entry anchored to the plugin root. So it reuses the existing
Ignore_Matcherand PHPCS ignore path unchanged, with the same root anchoring #1460's review asked for. - An unreadable
.distignoregives a warning and doesn't stop the scan, same as.pcpignore. Single-file plugins aren't supported, for the same reason.
Screenshots
| Before | After (plugin has a .distignore) |
|---|---|
![]() |
![]() |
After (plugin without a .distignore: option hidden) |
After, 390px |
|---|---|
![]() |
![]() |
Ready implementation
Dist_Ignore_Utility(new), with PHPUnit tests and a fixture plugin- the Admin checkbox (template, JS, AJAX flag)
--use-distignore, with a Behat scenario anddocs/CLI.md
All upstream workflows pass on the branch: PHP lint, PHPStan, PHPMD, JS lint, Gherkin lint, spell check, and PHPUnit and Behat across the PHP 7.4–8.4 / WP 6.3–trunk matrix (CI run). The only red step is the Codecov upload in one Behat job, which fails on forks because they have no CODECOV_TOKEN.
Relation to other issues and PRs
- #1159 asks for exclusions in the Admin UI and names
.distignorefiles as the first use case. This covers that case with no new settings to fill in. - #1181 also parses
.distignore, but as part of a larger change (include lists, a JSON config file) behind--use-config, CLI only. This proposal is smaller and covers both the Admin UI and the CLI. If the maintainers would rather land.distignoresupport through #1181, I'm happy to close this and help there instead.
Question for maintainers
Would you accept a PR for this? If you'd prefer a different shape, for example CLI only, or an option to import .distignore into .pcpignore instead, I'll adjust it.
Disclosure: drafted with the help of an AI coding assistant (Claude Code). I reviewed the code, tests and this text myself.
- Ngôn ngữ chính
- PHP
- Star
- 365
- Fork
- 135
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 20
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của WordPress/plugin-check
-
False positive trademarked_term warning for "wc" inside the word "Flowchart"Có thể đã có người làm @anandrajaram21 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
WordPress/plugin-check#1556 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
WordPress/plugin-check#1557 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
WordPress/plugin-check#1555 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PHPErrorReportingSniff flags debug constants used as values in const declarationsCó thể đã có người làm @elphizu đã nhận 7 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 35/100
WordPress/plugin-check#1553 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add checks to detect jQuery 4 incompatibilities ahead of WordPress 7.2 / 7.3Có thể đã có người làm @avinash-addweb đã nhận 12 ngày trước. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
WordPress/plugin-check#1549 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của WordPress/plugin-check
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quantum-php/project#222 ·
-
support
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
15.0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
mailcow/mailcow-dockerized#7717 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
mage-os/devdocs-website#75 ·



