Make WordPress Core

Opened 8 weeks ago

Last modified 3 weeks ago

#49783 new enhancement

PHPCS config: Persistent caching on Travis

Reported by: johnbillion Owned by:
Milestone: 5.5 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch commit
Focuses: coding-standards Cc:


Caching between linting runs with PHPCS was introduced in [45665]. We can go a step further and use a specific cache location and then instruct Travis CI to cache this between builds. This effectively reduces the linting time to a few seconds once the cache is warm.

Previously: #40539

Attachments (1)

49783.diff (1.2 KB) - added by johnbillion 8 weeks ago.

Download all attachments as: .zip

Change History (7)

8 weeks ago

#1 @johnbillion
8 weeks ago

  • Keywords has-patch added; needs-patch removed

#2 @jrf
8 weeks ago

Just checking: if I remember correctly, the caching feature checks if files have been changed since the last run and only runs phpcs on those changed files.

What I'm not so sure about is, whether the cache gets invalidated when PHPCS and/or external standards used with it, has been updated (i.e. composer update) and whether the cache gets invalidated if any of the used rulesets (project + underlying) change.

This should really need be verified in detail as if that is not the case, only changed files would get the benefit of updated rulesets/sniffs/fixes etc and the cache would quickly contain a lot of outdated information.

#3 @johnbillion
3 weeks ago

@jrf Excellent point and I'm going to check that before making the change. I would expect the cache interface to consider that, but definitely worth verifying.

#4 @johnbillion
3 weeks ago

cc @jdgrimes

#5 @johnbillion
3 weeks ago

According to https://github.com/squizlabs/PHP_CodeSniffer/issues/530 it appears that --cache and --cache=<file> behave differently. The former means the cache will not be invalidated if the standard changes, but the latter means it will.

#6 @johnbillion
3 weeks ago

  • Keywords commit added

Okay I've verified locally that changing the standard does invalidate the cache. I tested:

  • Manually altering the rules in phpcs.xml.dist
  • Altering (specifically, downgrading) the wp-coding-standards/wpcs version
  • Applying a different standard via the --standard CLI flag

Anything else that might need testing?

Note: See TracTickets for help on using tickets.