Skip to content

Fix failing CI: exclude CLI/ from VIP-Go RestrictedExtendClasses rule - #6

Merged
masteradhoc merged 1 commit into
masteradhoc:233-add-wpcli-foundationfrom
georgestephanis:fix/905-phpcs-vip-cli-warning
Sep 24, 2026
Merged

masteradhoc merged 1 commit into
masteradhoc:233-add-wpcli-foundationfrom
georgestephanis:fix/905-phpcs-vip-cli-warning

Conversation

@georgestephanis

Copy link
Copy Markdown

Fix-up for the CI failure on WordPress#905.

What's broken

The Lint PHP & PHP Compatibility checks. job fails on:

FILE: CLI/class-two-factor-cli-command.php
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
 19 | WARNING | We recommend extending `WPCOM_VIP_CLI_Command` instead of
    |         | `WP_CLI_Command` ...
    |         | (WordPressVIPMinimum.Classes.RestrictedExtendClasses.wp_cli)

WPCOM_VIP_CLI_Command only exists on VIP-managed hosting, so it doesn't
apply here -- WP_CLI_Command is the correct base class for a
wordpress.org-distributed plugin. It's a false positive for this context,
but since the repo's composer lint script runs plain phpcs with no
warning-severity suppression, the warning fails the whole job.

The fix

Adds a scoped <exclude-pattern> for that one rule on CLI/*.php, matching
the existing convention already used in phpcs.xml.dist for tests/*.php.

Verified locally:

  • ./vendor/bin/phpcs CLI/class-two-factor-cli-command.php -- exit 1 (the warning) before the fix, exit 0 after.
  • Full ./vendor/bin/phpcs run across the repo -- clean, no other regressions.

No functional code changed -- just the lint ruleset.

A couple of the smaller review nits from George's local review of WordPress#905 are
worth a look too, but are judgment calls left to you rather than something
this PR touches:

  • CLI/ is uppercase, inconsistent with lowercase providers//settings//includes/ elsewhere in the plugin.
  • No --porcelain flag for scripting status/backup-codes generate.

🤖 Generated with Claude Code

The `WordPressVIPMinimum.Classes.RestrictedExtendClasses` rule flags
`Two_Factor_CLI_Command extends WP_CLI_Command`, recommending
`WPCOM_VIP_CLI_Command` instead. That base class only exists on
VIP-managed hosting, so it doesn't apply to a generic wordpress.org
plugin -- WP_CLI_Command is the correct base class here.

This warning is currently failing the "Lint PHP & PHP Compatibility
checks" CI job, since the repo's `composer lint` script runs plain
phpcs with no warning-severity suppression.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: georgestephanis <georgestephanis@git.wordpress.org>
Co-authored-by: masteradhoc <masteradhoc@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@masteradhoc

Copy link
Copy Markdown
Owner

Thank you @georgestephanis !

@masteradhoc
masteradhoc merged commit c19e248 into masteradhoc:233-add-wpcli-foundation Sep 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants