Implement includes, config file support & .distignore parsing (#1108, #1159)#1181
Open
faisalahammad wants to merge 1 commit intoWordPress:trunkfrom
Open
Conversation
…rt, and .distignore parsing (WordPress#1108, WordPress#1159)
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Comment on lines
+274
to
+275
|
|
||
|
|
Member
|
Thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces comprehensive enhancements to how the Plugin Check tool filters files. It adds support for CLI include options, configuration files (
.plugin-check.json), and automatic.distignoreparsing. This addresses both #1108 (CLI includes) and #1159 (Admin UI exclusions via backend logic).Why This Change Is Needed
Currently, the tool only supports excluding files/directories via CLI flags. There is no way to:
tests/,node_modules/, etc.) by reading.distignore.How It Solves The Issue
1. New CLI Options
Added
--include-filesand--include-directoriesto thecheckcommand.--include-directoriesworks recursively.2. Configuration File Support
The tool now looks for a
.plugin-check.jsonfile in the plugin root.Example:
{ "exclude-directories": ["tests", "vendor"], "include-files": ["plugin.php"] }3.
.distignoreSupportIf a
.distignorefile exists, its patterns are automatically parsed and added to the exclusion list.*.md,build/).4. Hybrid Priority System
To ensure predictable behavior, we implemented a strict priority order:
.plugin-check.json).distignore(if present).git,node_modules)Verification
I have added comprehensive unit tests to verify:
Run the new tests:
Before vs After
Before:
User has to manually type long exclude strings every time:
After:
User can just run:
(And the tool automatically respects
.distignoreand.plugin-check.json)OR user can check just one file:
Checklist