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
If, for a parameter attribute, the value of the parameter 'Mandatory' is an integer, the rule will not be triggered:
Invoke-ScriptAnalyzer-ScriptDefinition @'function Test3{ [CmdletBinding()] [OutputType([String])] param( # this one has default value [Parameter(Mandatory=1)] $Param31="String", # this parameter has default value but it is not mandatory [Parameter(Mandatory=0)] $Param32='Test' ) $Param31 $Param31 = "test"}'@
Even if this writing is not a good practice since the runtime allows it, the rule should be triggered.
Unless to create a rule to handle this type of writing :-)
Good spot. There are many scripts that the PowerShell language parser would accept although it will blow up at runtime. Adding extra validation in PSSA makes sense in my opinion. I think the special case that you pointed out is rather rare but I'm sure PSSA would accept a PR with this improvement and I would be happy to help/assist you as far as I can. In general I'm happy to add new features/improvements to PSSA but I think there are bigger fish to fry at the moment.
If, for a parameter attribute, the value of the parameter 'Mandatory' is an integer, the rule will not be triggered:
Even if this writing is not a good practice since the runtime allows it, the rule should be triggered.
Unless to create a rule to handle this type of writing :-)
The text was updated successfully, but these errors were encountered: