Add -ScriptBlock
parameter to Invoke-ScriptAnalyzer
#2131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
Two separate but related changes (in different commits)
Adds a
-ScriptBlock
parameter toInvoke-ScriptAnalyzer
Can be passed by pipeline and also positionally.
I would say the usefulness of it is perhaps mixed/niche. For instance, it can never report a parse error, as the
ScriptBlock
must already be valid at runtime before it gets toInvoke-ScriptAnalyzer
to be stringified and analysed.It feels like this should already be part of PSSA. The number of times that I've tried to use a
ScriptBlock
is silly at this point - only to realise I need to quote (and fix existing quotes etc).closes #1937
Remove
ValueFromPipeline
andPosition=0
fromScriptDefinition
These are functionally impossible to use as there's no disambiguating parameter to differentiate the two (sets of two) string parameter sets
ScriptDefinition
, andPath
. One of the path parameter sets is the default so pipeline and positional strings are always bound to Path.Some doc updates that go along with it (I'm no wordsmith, so I'm very open to making any suggested changes here)
closes #2130
PR Checklist
.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
to the beginning of the title and remove the prefix when the PR is ready.