-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[ci] check PowerShell scripts with PSScriptAnalyzer (part 2) #6709
Conversation
@@ -100,7 +100,7 @@ fi | |||
if [[ $TASK == "lint" ]]; then | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right! Sorry 😅
|| true
would work too. I'm indifferent, since this is temporary anyway
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been using
|| true
as 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
, astrue
on 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.
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.
oh wow!
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.
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 😁
Linking full original PR: #6700.
Continuation of #6704.
This PR fixes only all
PSUseConsistentIndentation
warnings, so it can be skimmed fast without attention.