[wp-trac] [WordPress Trac] #57426: Coding Standards: mark warnings that trigger CI failures as errors.

WordPress Trac noreply at wordpress.org
Fri Jan 6 01:55:24 UTC 2023


#57426: Coding Standards: mark warnings that trigger CI failures as errors.
--------------------------------------+-------------------------------
 Reporter:  peterwilsoncc             |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Build/Test Tools          |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  coding-standards
--------------------------------------+-------------------------------

Comment (by jrf):

 @peterwilsoncc I'm not sure what you are trying to do here ? What is the
 problem you are trying to solve ?

 PHCPS will exit with a non-zero exit code for both errors and warnings
 and, by default, all tooling integrating with this will recognize that
 correctly.

 This behaviour can be changed (of course).

 In the WP PHPCS workflow, it _is_ changed for the files in `src` by using
 the `-n` CLI parameter which effectively silences all warnings.

 This was done for historic reasons: at the time the workflow was enabled,
 the `src` directory still contained over 6000 issues which needed
 developer attention (i.e. couldn't be auto-fixed without risk).
 It was decided to give contributors time to go through these issues, but
 not let it block CI in the mean time.

 Some of these issues are in actual fact errors, but have been downgraded
 in the WP Core `phpcs.xml.dist` file to warnings, precisely for this
 reason: to prevent CI failing (in combination with the `-n`), but to make
 sure that they still show up in IDEs.

 For the `test` directory, it was easier, and much less risky, to clean it
 up, so that directory yields no warnings or errors, which is why the `-n`
 flag is not applied for the test run (and why there are two separate PHPCS
 runs instead of just one).

 For those issues which were downgraded to warnings in the ruleset - if any
 of those are by now completely fixed in Core `src`, the downgrade in the
 ruleset should be removed.

 There are other options to change the PHPCS behaviour, but unless I
 understand better what you are trying to achieve, it's hard to advise.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57426#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list