Steps to reproduce
$ErrorView = 'NormalView'
Expected behavior
No warning is issued for assignment without use of any preference variable. This is another variation of #651 and an instance of #1641.
Actual behavior
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSUseDeclaredVarsMoreThanAssignment Warning config.ps1 27 The variable
s 'ErrorView' i
s assigned bu
t never used.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.1320
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1320
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
You cannot call a method on a null-valued expression.
At line:1 char:73
+ ... vailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
I am running PSScriptAnalyzer via MegaLinter v5.0.7.
Reactions are currently unavailable
Steps to reproduce
Expected behavior
No warning is issued for assignment without use of any preference variable. This is another variation of #651 and an instance of #1641.
Actual behavior
RuleName Severity ScriptName Line Message -------- -------- ---------- ---- ------- PSUseDeclaredVarsMoreThanAssignment Warning config.ps1 27 The variable s 'ErrorView' i s assigned bu t never used.Environment data
I am running PSScriptAnalyzer via MegaLinter v5.0.7.