Severity: Info
Location: bump-version.ps1:32-41
Code:
param(
[Parameter(Mandatory = $true, Position = 0)]
[ValidatePattern("^\d+\.\d+$")]
[string]$Version
)
# -----------------------------
# Convert short version to full versions
# -----------------------------
$fullVersion = if ($Version -match "^\d+\.\d+$") { "$Version.0" } else { $Version }
$fileVersion = if ($Version -match "^\d+\.\d+$") { "$Version.0.0" } else { "$Version.0.0" }
Explanation:
[ValidatePattern("^\d+\.\d+$")] is applied to $Version, so by the time the body of the script executes, $Version is guaranteed to match that exact pattern. The if conditions therefore always evaluate to $true, and the else branches are unreachable.
The $fileVersion line is also a no-op conditional — both branches return the same string "$Version.0.0".
Suggested fix:
$fullVersion = "$Version.0"
$fileVersion = "$Version.0.0"
This simplifies the file and removes code that might mislead a future maintainer into thinking the script accepts three-part versions.
Severity: Info
Location:
bump-version.ps1:32-41Code:
Explanation:
[ValidatePattern("^\d+\.\d+$")]is applied to$Version, so by the time the body of the script executes,$Versionis guaranteed to match that exact pattern. Theifconditions therefore always evaluate to$true, and theelsebranches are unreachable.The
$fileVersionline is also a no-op conditional — both branches return the same string"$Version.0.0".Suggested fix:
This simplifies the file and removes code that might mislead a future maintainer into thinking the script accepts three-part versions.