Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

Scaffolded code quality was not being validated - only file existence was checked. This adds Behat scenarios that run phpcs on generated code to ensure it meets WordPress coding standards.

Changes

  • New test file: features/scaffold-lint.feature with 6 scenarios covering:

    • Plugin scaffolding (main file and test files)
    • Post-type and taxonomy scaffolding
    • Child theme scaffolding
    • Block scaffolding
  • Background section: Installs phpcs once via helper plugin for all scenarios:

    Background:
      Given a WP install
      And I run `wp plugin path`
      And save STDOUT as {PLUGIN_DIR}
      When I run `wp scaffold plugin phpcs-helper --skip-tests`
      When I run `composer config --working-dir={PLUGIN_DIR}/phpcs-helper allow-plugins...`
      When I run `composer require --dev --working-dir={PLUGIN_DIR}/phpcs-helper ... wpcs`
  • Each scenario: Scaffolds code, runs phpcs with WordPress standard, asserts exit code 0

Example scenario

Scenario: Scaffold plugin and lint it
  When I run `wp scaffold plugin test-plugin`
  Then STDOUT should not be empty
  When I run `{PLUGIN_DIR}/phpcs-helper/vendor/bin/phpcs --standard=WordPress {PLUGIN_DIR}/test-plugin/test-plugin.php`
  Then the return code should be 0

The tests will catch any coding standard violations in scaffolded output before they reach users.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.wordpress.org
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • downloads.wordpress.org
    • Triggering command: /usr/bin/curl curl -sSfL REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Lint scaffolding results in Behat</issue_title>
<issue_description>We should look into setting Behat up so that it can generate code through the scaffolding command and then runs that generated code through linters/sniffers to make sure that the end result adheres to all standards and best practices.

From #109 (comment)</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 7, 2026 17:26
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Set up Behat for scaffolding results linting Add phpcs linting validation to Behat tests for scaffolded code Jan 7, 2026
Copilot AI requested a review from swissspidy January 7, 2026 17:37
@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review January 9, 2026 13:52
@swissspidy swissspidy requested a review from a team as a code owner January 9, 2026 13:52
@swissspidy swissspidy merged commit 78da8c4 into main Jan 9, 2026
24 of 45 checks passed
@swissspidy swissspidy deleted the copilot/set-up-behat-linting branch January 9, 2026 13:52
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.

Lint scaffolding results in Behat

2 participants