-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Summary
The CLI supports --exclude-files and --exclude-directories flags, but there's no equivalent option in the WordPress Admin UI. Developers running checks from the admin panel have no way to exclude development files from the scan.
Problem
When running Plugin Check from the Admin UI, developers receive errors for files that:
- Are listed in
.distignoreand won't be included in the wordpress.org distribution - Are development-only files (test suites, build scripts, CI configs)
- Are vendor dependencies that the plugin author doesn't control
While CLI users can work around this with --exclude-directories=tests/,vendor/, Admin UI users have no such option.
Proposed Solution
One or more of the following:
1. Add exclusion fields to the Admin UI
Allow users to specify directories and files to exclude directly in the check form, similar to the existing CLI flags.
2. Respect .distignore automatically
Skip files/directories listed in .distignore since these won't be in the final distribution anyway. This would benefit both CLI and Admin UI users by aligning checks with what actually gets submitted to wordpress.org.
3. Support a configuration file
Allow a .plugin-check.json or similar file that both CLI and Admin UI would respect:
{
"exclude-directories": ["tests/", "vendor/", "bin/"],
"exclude-files": ["phpunit.xml.dist", ".phpcs.xml.dist"]
}This would provide feature parity between CLI and Admin UI without requiring UI changes.
Use Case
I have a plugin with unit tests in a tests/ directory. These test files:
- Are listed in
.distignore - Will never be uploaded to wordpress.org
- Contain test-specific code that intentionally triggers scenarios that would fail checks
When running Plugin Check from the Admin UI, these files clutter the results and make it harder to focus on actual issues in distributable code. CLI users can exclude them, Admin UI users cannot.
Example files that shouldn't be checked:
tests/bootstrap.phptests/Unit/*.phpbin/install-wp-tests.shvendor/*phpunit.xml.dist.phpcs.xml.distcomposer.jsoncomposer.lock
Related Issues
- Implement exclusion of rules for the check results #823 - Implement exclusion of rules for the check results
- Proposal: Add Feature To Ignore Specific Checks Using Comments #1154 - Proposal: Add Feature To Ignore Specific Checks Using Comments
- Enhancement: Add CLI options to check specific files and directories #1108 - Enhancement: Add CLI options to check specific files and directories