Skip to content

Support file/directory exclusion in Admin UI #1159

@igorradovanov

Description

@igorradovanov

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 .distignore and 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.php
  • tests/Unit/*.php
  • bin/install-wp-tests.sh
  • vendor/*
  • phpunit.xml.dist
  • .phpcs.xml.dist
  • composer.json
  • composer.lock

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions