fix: remove dead conditional and unused variables in parsers.php
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
9a56301c41
commit
64cbda0140
1 changed files with 2 additions and 7 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue