Repository navigation
Build/Test Tools: Format copied Gutenberg style registry - #12778
benitoalba wants to merge 4 commits into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Pull request overview
Updates the Core build pipeline to normalize formatting in the copied Gutenberg style registry (registry.php) so that Core PHPCS scans pass in build-only environments without requiring PHP/Composer tooling.
Changes:
- Adds a
copy:gutenberg-stylesoptions.processhook that only targetsregistry.php. - Normalizes alignment around
=>for thehandle,path, anddependencieskeys, and adjusts spacing in non-empty dependency arrays during the copy step.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
lancewillett
left a comment
There was a problem hiding this comment.
Looks good to land. We can adjust from here with subsequent changes.
Align array assignment operators and normalize dependency array spacing when copying the generated style registry into Core. This allows PHPCS scans after build:dev to pass without requiring PHP tooling in build-only jobs. Developed in: #12778 Props benitoalba, desrosj, jorbin, wildworks. See #65278. git-svn-id: https://develop.svn.wordpress.org/trunk@63883 602fd350-edb4-49c9-b593-d223f7449a82
Align array assignment operators and normalize dependency array spacing when copying the generated style registry into Core. This allows PHPCS scans after build:dev to pass without requiring PHP tooling in build-only jobs. Developed in: WordPress/wordpress-develop#12778 Props benitoalba, desrosj, jorbin, wildworks. See #65278. Built from https://develop.svn.wordpress.org/trunk@63883 git-svn-id: http://core.svn.wordpress.org/trunk@63055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
Reopening after the revert in https://core.trac.wordpress.org/changeset/63919. Next step: settle the file-placement exceptions and upstream formatting approach before moving these forward. Discussion: https://wordpress.slack.com/archives/C08D0Q6BHNY/p1790267518339219 |
|
@desrosj following up: this is waiting on your call on file placement and upstream formatting for the copied style registry. Once you decide, I can land or adjust it. AI review · |
|
Tested this on trunk Before: after After: One problem: adding A smaller point: the key list and the padding are hard-coded. A new key from the generator, or a Full report is on the Trac ticket. |
|
@benitoalba @dhrupo found one change worth making before this lands. Setting Please scope the processing to the registry: options: {
noProcess: [ '**/*', '!**/registry.php' ],
process: function( content, srcpath ) {With that, the The hard-coded key list is lower risk. A new key would pass through unformatted rather than break the build, so it's fine to leave. My approval stands with that change. This still waits on @desrosj's file-placement call. AI review · |
|
Thanks @lancewillett and @dhrupo! Added noProcess and removed the filename check in 62922a2. Verified that binary files copy unchanged and the registry formatting stays the same. |
Formats the generated Gutenberg style registry while it is copied into Core.
Gutenberg currently outputs
registry.phpwith unaligned array operators and missing spaces inside non-empty dependency arrays. Runningbuild:devfollowed by a Core PHPCS scan therefore reports coding standards violations. The copy step normalizes those known fields without requiring PHP or Composer in build-only jobs.Processing is limited to
registry.phpwithnoProcess: [ '**/*', '!**/registry.php' ]. Other files are copied as buffers, preserving their bytes if Gutenberg adds binary assets. This also removes the need for the filename check inside the formatter.Trac ticket: https://core.trac.wordpress.org/ticket/65278
Testing
Validated against trunk
0ce33127d5with Node 24.18.0 and PHP 8.4.26.npm ci --no-audit --no-fundnpm run build:devandnpm run buildnpm run grunt -- jshint:gruntgit diff --checkThe unformatted registry reports 34 PHPCS errors and 40 warnings with the current Gutenberg build. The formatted output passes both Core rulesets.
A regression check runs the actual Grunt copy target with temporary PNG, raw binary, CSS with a byte-order mark, and nested registry fixtures. The original options alter all three non-registry fixtures. With this change, all 127 non-registry files, including the 124 existing style assets, copy byte for byte. The formatter runs only for the root and nested registries.
Both registry outputs match the previous formatter's output exactly and remain unchanged on a second pass. PHP confirms that all 20 entries retain their values and ordering. After both full builds, all 125 copied style files match the expected bytes. The temporary fixtures and validation scripts are kept outside the PR changes.
Use of AI Tools
AI assistance: Yes
Tool(s): OpenAI Codex
Model(s): GPT-5 (original work), GPT-6 (this follow-up)
Used for: Issue research, implementation, the review follow-up, and local validation.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.