fix: trim whitespace from --exclude parameter values#155
Merged
Conversation
The --exclude parameter for both wp core verify-checksums and wp plugin
verify-checksums failed to handle comma-separated values with spaces.
For example, --exclude="ai, plugin-check" would only exclude "ai" but
not "plugin-check" due to the leading space in the trimmed value.
Applied array_map('trim', explode(',', ...)) to normalize whitespace
in both Checksum_Core_Command and Checksum_Plugin_Command.
Added test cases for both commands to verify correct handling of
space-separated exclude values.
Fixes wp-cli#154
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes --exclude parsing for wp core verify-checksums and wp plugin verify-checksums so comma-separated values with surrounding whitespace are normalized (e.g., "a, b" behaves like "a,b"), addressing the silent non-exclusion bug reported in #154.
Changes:
- Trim whitespace around comma-separated
--excludeentries inChecksum_Core_CommandandChecksum_Plugin_Command. - Add a Behat scenario for core checksum verification to ensure space-separated excluded files are properly ignored.
- Add a Behat scenario for plugin checksum verification to cover space-separated excluded plugin slugs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Checksum_Plugin_Command.php | Trim --exclude list entries before strict comparisons against plugin slugs. |
| src/Checksum_Core_Command.php | Trim --exclude list entries before strict comparisons against core file paths. |
| features/checksum-plugin.feature | Add a scenario intended to validate excluding plugins when --exclude contains spaces. |
| features/checksum-core.feature | Add a scenario validating excluding core files when --exclude contains spaces. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This reverts commit b2ed9fa.
swissspidy
approved these changes
Jun 30, 2026
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.
The
--excludeparameter for bothwp core verify-checksumsandwp plugin verify-checksumsfailed to handle comma-separated values with spaces. For example,--exclude="ai, plugin-check"would only exclude "ai" but not "plugin-check" due to the leading space in the trimmed value.Applied
array_map('trim', explode(',', ...))to normalize whitespace in both Checksum_Core_Command and Checksum_Plugin_Command.Added test cases for both commands to verify correct handling of space-separated exclude values.
Fixes #154