Open Badgerati opened 1 month ago
Thoughts on putting together a common set of PSScriptAnalyzer rules for Pode instances? Detecting New-Object
should be pretty straight forward and I'm sure there are several other common detections we'd want. I'd be happy to help make that.
Describe the Change
Using
New-Object
to create objects is a lot slower than using:new()
. For example:Returns the following results on PS7.4.3:
Therefore,
:new()
should be used overNew-Object
.New-Object
should be replaced with:new()
instead. Ensuring all arguments are kept the same._.Tests.ps1
to make sure there are no new references toNew-Object
going forward.Contributing.md
to state:new()
should be used overNew-Object
.