Severity: Info
Location: bump-runtime.ps1:61-63,97,107-108
Code:
# Statistics counters
$global:totalFilesScanned = 0
$global:filesModified = 0
$global:totalReplacements = 0
...
$global:totalFilesScanned++
...
$global:filesModified++
$global:totalReplacements += $matchCount
Explanation:
The three statistics counters are assigned to the $global: scope. If this script is dot-sourced (. .\bump-runtime.ps1 10.0) the variables persist in the caller's session after the script exits, polluting the global namespace. Even when run normally, $global: is unnecessarily broad — the counters are only needed inside the script and its helper function.
Suggested fix:
Use $script: scope so the variables are visible to Update-Files but cleaned up when the script exits:
$script:totalFilesScanned = 0
$script:filesModified = 0
$script:totalReplacements = 0
…and inside Update-Files:
$script:totalFilesScanned++
...
$script:filesModified++
$script:totalReplacements += $matchCount
Same behavior, no session pollution.
Severity: Info
Location:
bump-runtime.ps1:61-63,97,107-108Code:
Explanation:
The three statistics counters are assigned to the
$global:scope. If this script is dot-sourced (. .\bump-runtime.ps1 10.0) the variables persist in the caller's session after the script exits, polluting the global namespace. Even when run normally,$global:is unnecessarily broad — the counters are only needed inside the script and its helper function.Suggested fix:
Use
$script:scope so the variables are visible toUpdate-Filesbut cleaned up when the script exits:…and inside
Update-Files:Same behavior, no session pollution.