Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
345af3b
fix(array-alignment): measure a long line's columns incrementally, no…
rlorenzo Oct 20, 2026
ec449a5
docs(bench): rerun the bake-off on v1.6.0
rlorenzo Oct 20, 2026
15ce930
perf(presets): start the worker with opcache.enable_cli=1, 8-15% less…
rlorenzo Oct 20, 2026
f77c4d3
perf(rules): find a line number with LineIndex, not by counting newli…
rlorenzo Oct 20, 2026
7489e99
perf(leading-comment): look up the comment by end offset, drop the pr…
rlorenzo Oct 20, 2026
ff2a2ff
perf(strings): find the start of a line without copying the text befo…
rlorenzo Oct 20, 2026
308fc85
perf(empty-catch-comment): skip a file without a catch
rlorenzo Oct 20, 2026
490d3f3
perf(phpcs-comments): build the comment tokens once per file and numb…
rlorenzo Oct 20, 2026
2bb6a3a
perf(calls): unwrap only the requested argument in Calls::argument
rlorenzo Oct 20, 2026
0c6d706
perf(escape-output): reuse the shared phpcs token stream instead of b…
rlorenzo Oct 20, 2026
2a5e033
bench: run phpcs with opcache.enable_cli=1 too, so both tools are mea…
rlorenzo Oct 20, 2026
89fe173
refactor(rules): share one PhpToken::tokenize of the file between the…
rlorenzo Oct 20, 2026
bf6a701
perf(superfluous-whitespace): skip a file with no whitespace at its e…
rlorenzo Oct 20, 2026
1b685c3
perf(class-comment, file-comment): number lines with LineIndex and dr…
rlorenzo Oct 20, 2026
4f08d52
docs(bench): rerun the bake-off with the worker speed-ups and phpcs o…
rlorenzo Oct 20, 2026
36ed029
bench: compare phpcs WordPress with the extension's default rules, wh…
rlorenzo Oct 20, 2026
4f3f1d8
docs: update the benchmarks to the 2026-10-20 bake-off (1.7× overall)…
rlorenzo Oct 20, 2026
2253c21
fix(array-alignment): keep the width memo in a typed property, which …
rlorenzo Oct 20, 2026
b31b57e
bench: include Mago's missing-docs rule, which covers the WordPress-D…
rlorenzo Oct 20, 2026
905ea05
docs: refresh the bake-off numbers with missing-docs in the timed rul…
rlorenzo Oct 20, 2026
69b57d5
chore(release): 1.6.1
rlorenzo Oct 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ WordPress Coding Standards for [Mago](https://github.com/carthage-software/mago)
ports the WPCS lint sniffs to Mago's linter, so a plugin or theme is checked in seconds, not
minutes.

## 2–12× faster than phpcs
## About 2× faster than phpcs on large plugins

<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/benchmarks-dark.svg">
<img alt="Bar chart: phpcs WordPress-Extra vs mago + mago-wordpress lint time on the top 10 WordPress.org plugins by active installs and WordPress core, from WooCommerce (33.40 s vs 3.32 s) down to Akismet (0.52 s vs 0.26 s)" src="docs/benchmarks-light.svg" width="800">
<img alt="Bar chart: phpcs WordPress vs mago + mago-wordpress lint time on the top 10 WordPress.org plugins by active installs and WordPress core, from WooCommerce (26.33 s vs 12.64 s) down to Akismet (0.70 s vs 0.57 s)" src="docs/benchmarks-light.svg" width="800">
</picture>

8.1× faster overall on the top 10 WordPress.org plugins plus WordPress core. Method and numbers:
1.8× faster overall on the top 10 WordPress.org plugins plus WordPress core: about 2–2.7× on the large plugins, about even on the small ones. Method and numbers:
[Benchmarks](docs/benchmarks.md).

## Install
Expand Down
4 changes: 2 additions & 2 deletions bench/bakeoff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ fi
first=$(ls "$out"/*.out | head -1)
echo "# Bake-off $(basename "$out"): top 10 WordPress.org plugins + WordPress core"
echo
echo "\`bench/bakeoff.sh\` (phpcs WordPress-Extra vs mago + mago-wordpress), mean of 3 runs after a warm-up."
echo "\`bench/bakeoff.sh\` (phpcs WordPress vs mago + mago-wordpress), mean of 3 runs after a warm-up."
[[ -f "$out/versions.txt" ]] || { echo "error: $out/versions.txt is missing; run the benchmarks first" >&2; exit 1; }
echo "Versions: $(grep -m1 "^mago " "$first"), $(cat "$out/versions.txt")."
echo
echo "## Results"
echo
echo "| Codebase | PHP files | phpcs \`WordPress-Extra\` | \`mago lint\` + extension | Speed-up |"
echo "| Codebase | PHP files | phpcs \`WordPress\` | \`mago lint\` + extension | Speed-up |"
echo "|:---|---:|---:|---:|---:|"
tf=0; tp=0; tm=0
for entry in "${codebases[@]}"; do
Expand Down
5 changes: 4 additions & 1 deletion bench/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ php-version = "8.2"
paths = [{$json($project)}]
excludes = ["**/vendor/**", "**/vendor_prefixed/**", "**/node_modules/**", "**/tests/**"]
[extension-hosts.wordpress]
command = ["php", {$json($worker)}]
command = ["php", "-d", "opcache.enable_cli=1", {$json($worker)}]

TOML);
file_put_contents("$work/composer.json", json_encode(
Expand All @@ -38,3 +38,6 @@ foreach (json_decode(stream_get_contents(STDIN), true)["extensions"][0]["linter-
if ($r["default-enabled"]) { echo $r["code"], ","; }
}' | sed 's/,$//')
[[ -n $codes ]] || { echo "could not list the extension rules" >&2; exit 1; }
# Mago's own missing-docs rule covers the WordPress-Docs sniffs the extension leaves to it; the presets
# enable it, so the timed run does too.
codes="$codes,missing-docs"
Loading
Loading