-
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
Allow Invoke-ScriptAnalyzer to take in piped paths or FileInfos #1132
Comments
The philosophy of PowerShell or Unix shells is that each command does one job and does it well. Invoke-scriptanalyzer already has a lot of parameters, piping the result of get-childitem does the job as you say and does not make the code more complicated or less readable. Compare this to other cmdlets like invoke-pester and you will find that they do not offer such options for this reason. I would close this as by design if you agree? |
Hi @bergmeister, thanks for the quick response. I just tried to pass the results of Get-ChildItem -Recurse | Invoke-ScriptAnalyzer
Looking at the help for the function, the |
@kitforbes Yes, you are right, although PSSA declares that it accepts pipeline input and I see tests for it, I can repro your example and it does not work with path strings either. This was maybe a regression that was introduced and somehow not caught by tests. |
Thanks @bergmeister. |
@kitforbes I looked into it and yes, this issue exists with the current release 1.17.1 but PR #1040 fixed this already so you can expect this to work in the next release |
With the current work around |
This is expected and even with the feature of being able to pipe multiple objects directly to it in the next version this will not change because as far as I am aware the processing of the pipeline is not aware of the whole list being piped to it. If there is a trick to know when the last object is being processed, please let me know. |
@bergmeister can't you add to the report in each |
Summary of the new feature
As a user I would like to add the
-Exclude
parameter toInvoke-ScriptAnalyzer
so that I can ignore certain directories from analysis.In my case, I want to test all of my
ps1
files, except those within avendor
directory, as these come from a third party. WithGet-ChildItem
, I can achieve this withI would expect
Invoke-ScriptAnalyzer
to have a similar implementation:What is the latest version of PSScriptAnalyzer at the point of writing
1.17.1
The text was updated successfully, but these errors were encountered: