Skip to content

fix: trim whitespace from --exclude parameter values#155

Merged
swissspidy merged 3 commits into
wp-cli:mainfrom
alaminfirdows:fix/issue-154
Jun 30, 2026
Merged

fix: trim whitespace from --exclude parameter values#155
swissspidy merged 3 commits into
wp-cli:mainfrom
alaminfirdows:fix/issue-154

Conversation

@alaminfirdows

Copy link
Copy Markdown
Contributor

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 #154

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
@alaminfirdows alaminfirdows requested a review from a team as a code owner June 27, 2026 02:47
@github-actions github-actions Bot added bug command:core-verify-checksums Related to 'core verify-checksums' command command:plugin-verify-checksums Related to 'plugin verify-checksums' command scope:testing Related to testing labels Jun 27, 2026
@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --exclude entries in Checksum_Core_Command and Checksum_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.

Comment thread features/checksum-plugin.feature
alaminfirdows and others added 2 commits June 29, 2026 19:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@swissspidy swissspidy added this to the 2.3.7 milestone Jun 30, 2026
@swissspidy swissspidy merged commit 6dd1167 into wp-cli:main Jun 30, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:core-verify-checksums Related to 'core verify-checksums' command command:plugin-verify-checksums Related to 'plugin verify-checksums' command scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--exclude does not trim whitespace, so space-separated entries are silently not excluded

3 participants