You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I did a number of improvements to my prototype but in fact the scope of the rule could be even more wider and might also applied to (incorrect) statements like:
Get-Date - $StartTime
Get-Date: Cannot bind parameter 'Date'. Cannot convert value "-" to type "System.DateTime". Error: "String '-' was not recognized as a valid DateTime."
Although it would already generate a clear error during run time, it would be nice to get the message and suggested correction during design time:
PowerShell has two parsing modes:
It is not always clear whenever PowerShell is in argument mode, as in:
For background information, see: Call operator (
&{}
) with no results doesn't type compare#24054
Yet from the argument name (and position and the operators) you could make a reasonable assumption that it probably concerns an operator instead.
For a (PowerShell based) rule prototype, see: https://github.com/iRon7/PSRules/blob/main/PossibleArgumentWithOperatorConfusion.psm1
The text was updated successfully, but these errors were encountered: