Invoke-PSRule -OutputFormat 'Json'
fails if all found rules are in RULE.EXCLUDE
#1832
Labels
Invoke-PSRule -OutputFormat 'Json'
fails if all found rules are in RULE.EXCLUDE
#1832
Description of the issue
RULE.EXCLUDE
.RULE.EXCLUDE
.As mentoined in this issue comment:
If doing
Invoke-PSRule -OutputFormat 'Json'
where all findings are excluded with-Option @{'RULE.EXCLUDE'=[string[]](<rules>)
, the command fails with errorOperationStopped: Index was outside the bounds of the array.
Seems it happens in the toJson override here:
Setting
-OutputFormat 'None'
works fine.To Reproduce
Steps to reproduce the issue:
Expected behaviour
ToString should not be called if no findings?
Module in use and version:
Additional context
The text was updated successfully, but these errors were encountered: