Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Running vendor/bin/phpcs -ps --parallel=$(nproc) --standard="core/phpcs.xml.dist"
against Drupal 10 produces the following warning:
FILE: /Volumes/dev/drupal/core/modules/locale/locale.module
----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
1063 | WARNING | Unused variable $strings.
| | (DrupalPractice.CodeAnalysis.VariableAnalysis.UnusedVariable)
----------------------------------------------------------------------------------------------------------
On Drupal 9 the errors are:
FILE: /Volumes/dev/drupal/core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateImageToolbarItemTest.php
--------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------------
165 | ERROR | [x] Array indentation error, expected 14 spaces but found 12
| | (Drupal.Arrays.Array.ArrayIndentation)
166 | ERROR | [x] Array indentation error, expected 14 spaces but found 12
| | (Drupal.Arrays.Array.ArrayIndentation)
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------
FILE: /Volumes/dev/drupal/core/modules/locale/locale.module
----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
1059 | WARNING | Unused variable $strings.
| | (DrupalPractice.CodeAnalysis.VariableAnalysis.UnusedVariable)
----------------------------------------------------------------------------------------------------------
FILE: /Volumes/dev/drupal/core/includes/install.inc
-----------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------
636 | WARNING | Unused variable $pos.
| | (DrupalPractice.CodeAnalysis.VariableAnalysis.UnusedVariable)
-----------------------------------------------------------------------------------------------------
Time: 18.32 secs; Memory: 10MB
Not sure we're not caught this...
Steps to reproduce
Run vendor/bin/phpcs -ps --parallel=$(nproc) --standard="core/phpcs.xml.dist"
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#4 | 3324540-10.x-3.patch | 3.72 KB | alexpott |
| |||
#4 | 10.x-2-3-interdiff.txt | 1.59 KB | alexpott |
#2 | 3324540-9.x-2.patch | 3.72 KB | alexpott |
#2 | 3324540-10.x-2.patch | 2.13 KB | alexpott |
|
Comments
Comment #2
alexpottAlso now that PHPCS does parallel running we can leverage that to always run a complete check on DrupalCI.
Comment #3
alexpottComment #4
alexpottSo the two 9.5.x only issues have been fix in 10.x for some reason but not fixed in 9.5.x - I think we should fix them in the same way so here's a 10.x patch to make things consistent.
Comment #5
alexpottNote we should not backport this to 9.4.x as we don't have the parallel phpcs changes there.
We have the Symfony PHP 8 polyfill so this works fine on PHP 7.3 and 7.4...
Comment #6
longwaveDiscussed in Slack with @alexpott. Root cause appears to be upgrading Coder (at different times on different branches) without a full run of PHPCS. The change to commit-code-check.sh that means we do a full PHPCS run every time, which only takes 10 seconds there now it is done in parallel, should prevent this from happening again in the future.
Comment #9
catchCommmitted/pushed to 10.1.x/10.0.x and 9.5.x respectively, thanks!