[ci] check PowerShell scripts with PSScriptAnalyzer (part 2)#6709
[ci] check PowerShell scripts with PSScriptAnalyzer (part 2)#6709
Conversation
| pwsh -command "Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -SkipPublisherCheck" | ||
| echo "Linting PowerShell code" | ||
| pwsh -file "./.ci/lint-powershell.ps1" || exit 0 | ||
| pwsh -file "./.ci/lint-powershell.ps1" || : |
There was a problem hiding this comment.
Just noticed that after moving powershell linter upper all other ones, || exit 0 causes terminating the whole script earlier than running all linters.
Ref. for :
There was a problem hiding this comment.
ah right! Sorry 😅
|| true would work too. I'm indifferent, since this is temporary anyway
There was a problem hiding this comment.
I checked the lint job logs (build link) and can confirm all the other linting is running, so looks like this works. Thanks very much for the Stack Overflow link, I hadn't seen || : before.
There was a problem hiding this comment.
Oh and I hadn't yet clicked that S/O link before suggesting || true. I see it says there:
The above suggestions to use 'true' will also work, but are inefficient as 'true' is an external program.
That's good to know! I have been using || true as a habit for a long tim.
There was a problem hiding this comment.
I have been using
|| trueas a habit for a long tim.
Me too. And hah, seems it's OK - just noticed the following comment under the S/O answer:
True is only an external program if you run
/bin/true, astrueon its own is a shell built-in of bash, just like echo and test, which also exists as external programs but are also built-ins in bash and if you don't give a full path, the built-ins will be used.
jameslamb
left a comment
There was a problem hiding this comment.
Thanks very much for doing the work of breaking these into smaller PRs! I'm glad to see this standardization of indentation in these scripts too 😁
|
This pull request has been automatically locked since there has not been any recent activity since it was closed. |
Linking full original PR: #6700.
Continuation of #6704.
This PR fixes only all
PSUseConsistentIndentationwarnings, so it can be skimmed fast without attention.