-
Notifications
You must be signed in to change notification settings - Fork 394
Allow -Setting parameter to resolve setting presets as well when object is still a PSObject in BeginProcessing #928
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
Changes from all commits
923a257
0202721
efd427a
4815351
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,6 +406,13 @@ Describe "Test CustomizedRulePath" { | |
Pop-Location | ||
} | ||
} | ||
|
||
It "resolves rule preset when passed in via pipeline" { | ||
$warnings = 'CodeFormattingStroustrup' | ForEach-Object { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems overly complicated, isn't this just:
all the pipes and where's aren't needed and only add complexity There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pipes are needed to reproduce the actual bug because otherwise the settings object is already resolved to a string in your case but I will get rid of the where clause and add the additional assertion as you suggested. |
||
Invoke-ScriptAnalyzer -ScriptDefinition 'if ($true){}' -Settings $_} | ||
$warnings.Count | Should -Be 1 | ||
$warnings.RuleName | Should -Be 'PSUseConsistentWhitespace' | ||
} | ||
|
||
It "Should use the CustomRulePath parameter" { | ||
$settings = @{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no check of the return, does it not matter if we get to this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check for the return value is only needed for the first method call. If we still cannot resolve the settings type at this point, then the mode will be
SettingsMode.None
(this is the initial default) and that gets handled later on.