-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run rules with settings file that run fine with hashtable #1160
Comments
Hmm, maybe there is a small problem in the psd1 file that makes problems when parsing it. PSSA does not have a good error behaviour in this area (it fails silently and decides to not use the settings file if it cannot parse it without giving parse error details). Run it with -Verbose to see more details of where it goes wrong. |
I've figured it out! |
In case people are interested, arrays in PowerShell essentially are anything with The When you don't use commas, the expression is evaluated as a statement, and its output added to the array. So
is actually equivalent to
rather than
(The first two being an array container with three statements each emitting one output, and the last being an array container with a single statement emitting three outputs). So technically, allowing newlines means you don't have a statically determinable array: function Get-Things
{
for ($i = 0; $i -lt 10; $i++) { $i }
}
# This has 11 elements
@(Get-Things, 11) But, people are so used to it working that it would cause problems |
I've got a script with some compatibility bugs in it. I can run the compatibility rules on it like this:
And get:
But when I put the settings in a psd1 file and run the same with:
I get no output.
Is this expected behaviour -- is there something I need to add to a settings file to make this work? Or is this something I should be fixing in the engine?
The text was updated successfully, but these errors were encountered: