From b49e4537a8835b98e2586fe5ca80db10476fff8d Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Fri, 13 Nov 2026 20:53:28 +0100 Subject: [PATCH] keep forge failed to load patterns on one line --- src/Analysis/Problem/Forge/ClientOnlyModProblem.php | 3 ++- src/Analysis/Problem/Forge/ModFatalProblem.php | 3 ++- test/tests/Performance/PatternSafetyTest.php | 4 ---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Analysis/Problem/Forge/ClientOnlyModProblem.php b/src/Analysis/Problem/Forge/ClientOnlyModProblem.php index 2f40771e..96b0e84c 100644 --- a/src/Analysis/Problem/Forge/ClientOnlyModProblem.php +++ b/src/Analysis/Problem/Forge/ClientOnlyModProblem.php @@ -40,7 +40,8 @@ public function getMessage(): string public static function getPatterns(): array { return [ - '/^\s*([^\(\n]+) \(([^\)]+)\) (?:has failed to load correctly|encountered an error during[^\n]*)\n' . static::CLIENT_ONLY_CAUSE . '/m' + // the name and id stay on one line, otherwise every "(" makes the pattern scan the rest of the entry + '/^\h*([^\(\n]+) \(([^\)\n]+)\) (?:has failed to load correctly|encountered an error during[^\n]*)\n' . static::CLIENT_ONLY_CAUSE . '/m' ]; } diff --git a/src/Analysis/Problem/Forge/ModFatalProblem.php b/src/Analysis/Problem/Forge/ModFatalProblem.php index 46395190..b5655583 100644 --- a/src/Analysis/Problem/Forge/ModFatalProblem.php +++ b/src/Analysis/Problem/Forge/ModFatalProblem.php @@ -36,7 +36,8 @@ public static function getPatterns(): array return [ 'mod-state' => '/U[LCHIJAD]*E\s+(?\w+)\{(?[^\}]+)\} \[(?[^\]]+)\] \((?[^\)]+)\)/', // client-only causes are handled by ClientOnlyModProblem - 'failed-to-load' => '/^\s*(?[^\(\n]+) \((?[^\)]+)\) has failed to load correctly(?!\n' . ClientOnlyModProblem::CLIENT_ONLY_CAUSE . ')/m' + // the name and id stay on one line, otherwise every "(" makes the pattern scan the rest of the entry + 'failed-to-load' => '/^\h*(?[^\(\n]+) \((?[^\)\n]+)\) has failed to load correctly(?!\n' . ClientOnlyModProblem::CLIENT_ONLY_CAUSE . ')/m' ]; } diff --git a/test/tests/Performance/PatternSafetyTest.php b/test/tests/Performance/PatternSafetyTest.php index 8832e356..a60234e2 100644 --- a/test/tests/Performance/PatternSafetyTest.php +++ b/test/tests/Performance/PatternSafetyTest.php @@ -4,9 +4,7 @@ use Aternos\Codex\Analysis\PatternInsightInterface; use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\ChunkLoadExceptionProblem; -use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ClientOnlyModProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModDependencyProblem; -use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModFatalProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Paper\ServerJarInPluginFolderProblem; use Aternos\Codex\Minecraft\Test\Logs\TestLog; use FilesystemIterator; @@ -77,9 +75,7 @@ class PatternSafetyTest extends TestCase */ protected const array KNOWN_UNSAFE_PATTERNS = [ ChunkLoadExceptionProblem::class => [0, 1, 2], - ClientOnlyModProblem::class => [0], ModDependencyProblem::class => ["loading-failed-exception"], - ModFatalProblem::class => ["failed-to-load"], ServerJarInPluginFolderProblem::class => [0], ];