From 403671544a046f17439e1be8a56931c1904f86cd Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 01:57:02 +0900 Subject: fix(linters): treat array-of-table headers as section boundaries The Cargo.toml section-header pattern only matched single-bracket headers, so a `[[bench]]` / `[[bin]]` / `[[test]]` table left the previous section active and its keys were attributed to whatever `[dependencies]` block preceded it. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/linters/src/Linters/CargoWorkspaceDependencies.php | 2 +- scripts/linters/src/Linters/SortedDependencies.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/linters/src') diff --git a/scripts/linters/src/Linters/CargoWorkspaceDependencies.php b/scripts/linters/src/Linters/CargoWorkspaceDependencies.php index 3ad86b6f..d50b5f42 100644 --- a/scripts/linters/src/Linters/CargoWorkspaceDependencies.php +++ b/scripts/linters/src/Linters/CargoWorkspaceDependencies.php @@ -48,7 +48,7 @@ final class CargoWorkspaceDependencies implements Linter foreach (file($path) as $idx => $rawLine) { $stripped = trim($rawLine); - if (preg_match('/\A\[([^\]]+)\]\z/', $stripped, $m)) { + if (preg_match('/\A\[\[?([^\[\]]+)\]\]?\z/', $stripped, $m)) { $currentSection = $m[1]; continue; } diff --git a/scripts/linters/src/Linters/SortedDependencies.php b/scripts/linters/src/Linters/SortedDependencies.php index 78ea0eb2..7a9fe20c 100644 --- a/scripts/linters/src/Linters/SortedDependencies.php +++ b/scripts/linters/src/Linters/SortedDependencies.php @@ -62,7 +62,7 @@ final class SortedDependencies implements Linter foreach (explode("\n", $content) as $line) { $stripped = rtrim($line, "\r\n"); - if (preg_match('/\A\s*\[([^\]]+)\]\s*\z/', $stripped, $m)) { + if (preg_match('/\A\s*\[\[?([^\[\]]+)\]\]?\s*\z/', $stripped, $m)) { $current = $m[1]; $sections[$current] ??= []; continue; -- cgit v1.3.1-4-g156e