bcurran3 / ChocolateyPackages

My published Chocolatey packages
206 stars 94 forks source link

PSScriptAnalyzer fixes #323

Closed slycordinator closed 7 months ago

slycordinator commented 1 year ago

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:

bcurran3 commented 1 year ago

This is neat. Need to "digest."

slycordinator commented 1 year ago

Should be good now.

bcurran3 commented 1 year ago

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.

slycordinator commented 1 year ago

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: @.***>

bcurran3 commented 7 months ago

Closing this as I am no longer creating or maintaining Chocolatey packages. Sorry, out of my control.

Hopefully you've enjoyed my work and found it useful.

Bella Ciao!