Closed slycordinator closed 7 months ago
This is neat. Need to "digest."
Should be good now.
I'm really not a fan of it moving $null to the left of var checks, makes it harder (for me) to read. Is there an option you can give PSScriptAnalyzer to not do that? If so, that would be my preference. If not, I guess I'll just have to deal with it. LMK.
Yes, you can disable any rule of PSScriptAnalyzer.
For instance, the cli utility Invoke-ScriptAnalyzer has an option -ExcludeRule that takes a comma-separated string of each rule you wish to exclude.
On Sat, Apr 29, 2023, 6:19 PM bcurran3 @.***> wrote:
I'm really not a fan of it moving $null to the left of var checks, makes it harder (for me) to read. Is there an option you can give PSScriptAnalyzer to not do that? If so, that would be my preference. If not, I guess I'll just have to deal with it. LMK.
— Reply to this email directly, view it on GitHub https://github.com/bcurran3/ChocolateyPackages/pull/323#issuecomment-1528730218, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQN7DTN2XXOH6NDFZEU45NTXDTML7ANCNFSM6AAAAAAWXJBJFA . You are receiving this because you authored the thread.Message ID: @.***>
Fixes to powershell scripts according to recommendations from PSScriptAnalyzer .
The changes are: 1) Replacing an alias for the full name % -> ForEach-Object ? -> Where-Object foreach -> ForEach-Object select -> Select-Object sort -> Sort-Object start -> Start-Process del -> Remove-Item ChildItem -> Get-ChildItem gwmi -> Get-WmiObject
2) Changing comparisons of a variable with $null to place $null on the left side In PowerShell: