Skip to content

Conversation

@nickvergessen
Copy link
Member

@nickvergessen nickvergessen commented Jan 15, 2026

Since PHP 8.3 the linting command "php -l" can consume multiple files at once.
This drastically speeds up the time necessary for the linting from ~3 minutes
to few seconds.
By also running the linting on multiple cores, the time can be dropped to < 1s

@nickvergessen nickvergessen added this to the Nextcloud 33 milestone Jan 15, 2026
@nickvergessen nickvergessen self-assigned this Jan 15, 2026
@nickvergessen nickvergessen requested a review from a team as a code owner January 15, 2026 11:31
@nickvergessen nickvergessen requested review from Altahrim, ArtificialOwl, come-nc and salmart-dev and removed request for a team January 15, 2026 11:31
@nickvergessen nickvergessen marked this pull request as draft January 15, 2026 12:48
Signed-off-by: Joas Schilling <[email protected]>
Since PHP 8.3 the linting command "php -l" can consume multiple files at once.
This drastically speeds up the time necessary for the linting from ~3 minutes
to few seconds.
By also running the linting on multiple cores, the time can be dropped to < 1s

Signed-off-by: Joas Schilling <[email protected]>
@nickvergessen nickvergessen changed the title Ci/noid/speedup lint ci(lint): Lint multiple files at once when possible Jan 15, 2026
@nickvergessen nickvergessen added 3. to review Waiting for reviews CI labels Jan 15, 2026
Comment on lines +68 to +69
"lint-8.2-or-earlier": "[ $(php -r \"echo PHP_VERSION_ID;\") -ge 80300 ] || find . -type f -name '*.php' -not -path './3rdparty/*' -not -path '*/composer/*' -not -path '*/stubs/*' -not -path '*/vendor-bin/*' -not -path '*/vendor/*' | xargs -n1 -P$(nproc) php -l",
"lint-8.3-or-later": "[ $(php -r \"echo PHP_VERSION_ID;\") -lt 80300 ] || find . -type f -name '*.php' -not -path './3rdparty/*' -not -path '*/composer/*' -not -path '*/stubs/*' -not -path '*/vendor-bin/*' -not -path '*/vendor/*' | xargs -n200 -P$(nproc) php -l",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"lint-8.2-or-earlier": "[ $(php -r \"echo PHP_VERSION_ID;\") -ge 80300 ] || find . -type f -name '*.php' -not -path './3rdparty/*' -not -path '*/composer/*' -not -path '*/stubs/*' -not -path '*/vendor-bin/*' -not -path '*/vendor/*' | xargs -n1 -P$(nproc) php -l",
"lint-8.3-or-later": "[ $(php -r \"echo PHP_VERSION_ID;\") -lt 80300 ] || find . -type f -name '*.php' -not -path './3rdparty/*' -not -path '*/composer/*' -not -path '*/stubs/*' -not -path '*/vendor-bin/*' -not -path '*/vendor/*' | xargs -n200 -P$(nproc) php -l",
"lint-8.2-or-earlier": "[ $(php -r \"echo PHP_VERSION_ID;\") -ge 80300 ] || find . -type f -name '*.php' -not -path './3rdparty/*' -not -path '*/composer/*' -not -path '*/stubs/*' -not -path '*/vendor-bin/*' -not -path '*/vendor/*' -print0 | xargs -0 -n1 -P$(nproc) php -l",
"lint-8.3-or-later": "[ $(php -r \"echo PHP_VERSION_ID;\") -lt 80300 ] || find . -type f -name '*.php' -not -path './3rdparty/*' -not -path '*/composer/*' -not -path '*/stubs/*' -not -path '*/vendor-bin/*' -not -path '*/vendor/*' -print0 | xargs -0 -n200 -P$(nproc) php -l",

It should be even more reliable like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants