-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable parallel processing for PHPCS sniffs #61700
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Regarding prior art, WordPress Core uses this same setting here: https://github.com/WordPress/wordpress-develop/blob/13d5244c43d65da5fd3ff7abd390fa36bb4a87b5/phpcs.xml.dist#L27-L28. I'm not 100% clear on how the value of |
@anton-vlasenko I see no reason why this shouldn't be included. Not even sure why you're asking me for a review for something as trivial as this.
Note: only when available via the PCTNL extension and depending on the number of Cores available, so results will vary (and it has no effect when run on Windows as the PCTNL extension isn't available).
At this moment, this is the closest you can get to docs: PHPCSStandards/PHP_CodeSniffer#10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anton-vlasenko.
@ironprogrammer Yes, I saw these documentation issues on GH as well. Thanks for posting. Regarding the setting, PHPCS spawns 20 processes with approximately 18 files to check in each process. I propose starting with 20 and changing it later if there are any complaints. |
@jrfnl I requested your review to ensure all angles were covered, given your expertise. |
Thank you, everyone, for your input/reviews! |
Enable parallel processing for PHPCS sniffs. Documentation: PHPCSStandards/PHP_CodeSniffer#10 Co-authored-by: anton-vlasenko <antonvlasenko@git.wordpress.org> Co-authored-by: desrosj <desrosj@git.wordpress.org> Co-authored-by: ironprogrammer <ironprogrammer@git.wordpress.org> Co-authored-by: jrfnl <jrf@git.wordpress.org>
This reverts commit 8331820.
Enable parallel processing for PHPCS sniffs. Documentation: PHPCSStandards/PHP_CodeSniffer#10 Co-authored-by: anton-vlasenko <antonvlasenko@git.wordpress.org> Co-authored-by: desrosj <desrosj@git.wordpress.org> Co-authored-by: ironprogrammer <ironprogrammer@git.wordpress.org> Co-authored-by: jrfnl <jrf@git.wordpress.org>
This reverts commit 8331820.
This reverts commit 8331820.
This reverts commit e74d71c.
This reverts commit 8331820.
This reverts commit e74d71c.
This reverts commit 8331820.
This reverts commit e74d71c.
This reverts commit 8331820.
This reverts commit e74d71c.
Enable parallel processing for PHPCS sniffs. Documentation: PHPCSStandards/PHP_CodeSniffer#10 Co-authored-by: anton-vlasenko <antonvlasenko@git.wordpress.org> Co-authored-by: desrosj <desrosj@git.wordpress.org> Co-authored-by: ironprogrammer <ironprogrammer@git.wordpress.org> Co-authored-by: jrfnl <jrf@git.wordpress.org>
This reverts commit 8331820.
This reverts commit e74d71c.
This reverts commit 8331820.
This reverts commit e74d71c.
This reverts commit 8331820.
This reverts commit e74d71c.
This reverts commit 8331820.
This reverts commit e74d71c.
This reverts commit 8331820.
This reverts commit e74d71c.
* Create bindings util for transforming block attributes * Get attributes and name from the store * Change function to return only the bound attributes * Add action, selector, and reducer for block context * Sync store in edit component * Revert "Sync store in edit component" This reverts commit 988c4b6. * Move logic to BlockContextProvider * Change parent context logic * Use useLayoutEffect * Go back to syncing store in edit component * WIP: Move bindings logic to `getBlockAttributes` * WIP: Move bindings setAttributes logic to updateBlockBindings * Pass only `select` to `getValue` functions * Remove old editor hook * Add fallback to postId until context is ready * Remove setValue post-meta code * Simplify fallback conditional * Change bindings destructuring * Check canBindAttribute in updateBlockAttributes * Update unit tests to expect a dispatch * Add conditional in block * Don't use `getBlockAttributes` inside `getValue` * Revert "Don't use `getBlockAttributes` inside `getValue`" This reverts commit 0e91129. * Avoid processing bindings recursively * Access context through selector * Update getBlockAttributes logic * Don't use fallbacks * Add edit value posibility for post meta, add function to check if is admin * Revert "Add edit value posibility for post meta, add function to check if is admin" This reverts commit 9659455. * Test editing is allowed in paragraph block * Test protected fields are not editable * Revert "Enable parallel processing for PHPCS sniffs (#61700)" This reverts commit 8331820. * Add post meta setValue function * Update tests to check contenteditable * Update lockAttributesEditing default * Pass arguments to lockAttributesEditing * Check user can edit post meta * Check field is exposed in the REST API * Disable editing in templates * Add fallback for postId * Revert "Revert "Enable parallel processing for PHPCS sniffs (#61700)"" This reverts commit e74d71c. * Adapt old tests * Simplify lockAttributesEditing fallbacks * Don't use fallback for context * Add postType fallback when locking controls * Pass context in rich text * Check contenteditable attribute in test * Change name to `canUserEditValue` * Revert changes caused by rebasing * Add space back * Pass block context through rich text * Change imports * Transform block attributes into bindings in split selection * Pass context to in use-input * Change REST API check * Use getBoundAttributesValues * Don't split when attribute is bound * Revert changes caused by rebase * Cover more blocks when editing custom fields * Add a warning when pasting blocks --------- Co-authored-by: Carlos Bravo <carlos.bravo@automattic.com>
* Create bindings util for transforming block attributes * Get attributes and name from the store * Change function to return only the bound attributes * Add action, selector, and reducer for block context * Sync store in edit component * Revert "Sync store in edit component" This reverts commit 988c4b6. * Move logic to BlockContextProvider * Change parent context logic * Use useLayoutEffect * Go back to syncing store in edit component * WIP: Move bindings logic to `getBlockAttributes` * WIP: Move bindings setAttributes logic to updateBlockBindings * Pass only `select` to `getValue` functions * Remove old editor hook * Add fallback to postId until context is ready * Remove setValue post-meta code * Simplify fallback conditional * Change bindings destructuring * Check canBindAttribute in updateBlockAttributes * Update unit tests to expect a dispatch * Add conditional in block * Don't use `getBlockAttributes` inside `getValue` * Revert "Don't use `getBlockAttributes` inside `getValue`" This reverts commit 0e91129. * Avoid processing bindings recursively * Access context through selector * Update getBlockAttributes logic * Don't use fallbacks * Add edit value posibility for post meta, add function to check if is admin * Revert "Add edit value posibility for post meta, add function to check if is admin" This reverts commit 9659455. * Test editing is allowed in paragraph block * Test protected fields are not editable * Revert "Enable parallel processing for PHPCS sniffs (WordPress#61700)" This reverts commit 8331820. * Add post meta setValue function * Update tests to check contenteditable * Update lockAttributesEditing default * Pass arguments to lockAttributesEditing * Check user can edit post meta * Check field is exposed in the REST API * Disable editing in templates * Add fallback for postId * Revert "Revert "Enable parallel processing for PHPCS sniffs (WordPress#61700)"" This reverts commit e74d71c. * Adapt old tests * Simplify lockAttributesEditing fallbacks * Don't use fallback for context * Add postType fallback when locking controls * Pass context in rich text * Check contenteditable attribute in test * Change name to `canUserEditValue` * Revert changes caused by rebasing * Add space back * Pass block context through rich text * Change imports * Transform block attributes into bindings in split selection * Pass context to in use-input * Change REST API check * Use getBoundAttributesValues * Don't split when attribute is bound * Revert changes caused by rebase * Cover more blocks when editing custom fields * Add a warning when pasting blocks --------- Co-authored-by: Carlos Bravo <carlos.bravo@automattic.com>
* Create bindings util for transforming block attributes * Get attributes and name from the store * Change function to return only the bound attributes * Add action, selector, and reducer for block context * Sync store in edit component * Revert "Sync store in edit component" This reverts commit 988c4b6. * Move logic to BlockContextProvider * Change parent context logic * Use useLayoutEffect * Go back to syncing store in edit component * WIP: Move bindings logic to `getBlockAttributes` * WIP: Move bindings setAttributes logic to updateBlockBindings * Pass only `select` to `getValue` functions * Remove old editor hook * Add fallback to postId until context is ready * Remove setValue post-meta code * Simplify fallback conditional * Change bindings destructuring * Check canBindAttribute in updateBlockAttributes * Update unit tests to expect a dispatch * Add conditional in block * Don't use `getBlockAttributes` inside `getValue` * Revert "Don't use `getBlockAttributes` inside `getValue`" This reverts commit 0e91129. * Avoid processing bindings recursively * Access context through selector * Update getBlockAttributes logic * Don't use fallbacks * Add edit value posibility for post meta, add function to check if is admin * Revert "Add edit value posibility for post meta, add function to check if is admin" This reverts commit 9659455. * Test editing is allowed in paragraph block * Test protected fields are not editable * Revert "Enable parallel processing for PHPCS sniffs (WordPress#61700)" This reverts commit 8331820. * Add post meta setValue function * Update tests to check contenteditable * Update lockAttributesEditing default * Pass arguments to lockAttributesEditing * Check user can edit post meta * Check field is exposed in the REST API * Disable editing in templates * Add fallback for postId * Revert "Revert "Enable parallel processing for PHPCS sniffs (WordPress#61700)"" This reverts commit e74d71c. * Adapt old tests * Simplify lockAttributesEditing fallbacks * Don't use fallback for context * Add postType fallback when locking controls * Pass context in rich text * Check contenteditable attribute in test * Change name to `canUserEditValue` * Revert changes caused by rebasing * Add space back * Pass block context through rich text * Change imports * Transform block attributes into bindings in split selection * Pass context to in use-input * Change REST API check * Use getBoundAttributesValues * Don't split when attribute is bound * Revert changes caused by rebase * Cover more blocks when editing custom fields * Add a warning when pasting blocks --------- Co-authored-by: Carlos Bravo <carlos.bravo@automattic.com>
What?
This PR adds parallel processing for PHPCS sniffs.
Fixes #61699.
Why?
Parallel processing significantly improves speed by using multiple processes to run the PHPCS linters (300% speed increase in my tests).
How?
It's a matter of adding a single line to the
phpcs.xml.dist
file.That's it.
I'm not able to find any documentation on that setting, but it seems to work great.
Testing Instructions
Make sure that GitHub CI jobs pass.
Testing Instructions for Keyboard
Screenshots or screencast