From 64cbda01406a7a45585a8725aa42d1f25af81945 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 24 Nov 2025 08:45:42 +0100 Subject: [PATCH] fix: remove dead conditional and unused variables in parsers.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove useless conditional check for hyphens in service name normalization The conditional `if (str($serviceName)->contains('-'))` never executes because $serviceName is already normalized with underscores from parseServiceEnvironmentVariable() - Always normalize service names explicitly to match docker_compose_domains lookup This makes the code clearer and more maintainable - Remove unused $fqdnWithPort variable assignments in both applicationParser and serviceParser The variable is calculated but never used - only $urlWithPort and $fqdnValueForEnvWithPort are needed These changes are code cleanup only - no behavior changes or breaking changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- bootstrap/helpers/parsers.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bootstrap/helpers/parsers.php b/bootstrap/helpers/parsers.php index ba1797dd8..8286b643a 100644 --- a/bootstrap/helpers/parsers.php +++ b/bootstrap/helpers/parsers.php @@ -537,9 +537,8 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int } $originalServiceName = str($serviceName)->replace('_', '-'); - if (str($serviceName)->contains('-')) { - $serviceName = str($serviceName)->replace('-', '_')->replace('.', '_'); - } + // Always normalize service names to match docker_compose_domains lookup + $serviceName = str($serviceName)->replace('-', '_')->replace('.', '_'); // Generate BOTH FQDN & URL $fqdn = generateFqdn(server: $server, random: "$originalServiceName-$uuid", parserVersion: $resource->compose_parsing_version); @@ -552,11 +551,9 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int // Append port if specified $urlWithPort = $url; - $fqdnWithPort = $fqdn; $fqdnValueForEnvWithPort = $fqdnValueForEnv; if ($port && is_numeric($port)) { $urlWithPort = "$url:$port"; - $fqdnWithPort = "$fqdn:$port"; $fqdnValueForEnvWithPort = "$fqdnValueForEnv:$port"; } @@ -1653,11 +1650,9 @@ function serviceParser(Service $resource): Collection } } - $fqdnWithPort = $fqdn; $urlWithPort = $url; $fqdnValueForEnvWithPort = $fqdnValueForEnv; if ($fqdn && $port) { - $fqdnWithPort = "$fqdn:$port"; $fqdnValueForEnvWithPort = "$fqdnValueForEnv:$port"; } if ($url && $port) {