$global:ProjectName = $null
function RunFirst(){
RunSecund
Write-Host $global:ProjectName
}
function RunSecund(){
$global:ProjectName = "a name"
}
In RunSecund I get:
The variable 'ProjectName' is assigned but never used. PSScriptAnalyzer(PSUseDeclaredVarsMoreThanAssignments)
Although, if you must, you can suppress PSSA warnings with SuppressMessageAttribute:
function RunSecund(){
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUserDeclaredVarsMoreThanAssignments', '', Scope='Function')]
$global:ProjectName = "a name"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With