-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
add shellcheck action to lint bash scripts #3710
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
base: master
Are you sure you want to change the base?
Conversation
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.
Thank you for providing this PR.
Honestly I'm not a fan of shellcheck
on big projects myself, running shellcheck
locally on self-hosted shows many errors and warnings which many are not a big deal.
I'd suggest running shellcheck
locally and fix any issue which you may see and provide a PR for them, but I do not see a benefit of adding shellcheck
in case we want to ignore it everywhere.
--shell=bash \ | ||
--exclude=SC1090,SC1091 \ | ||
--format=json1 \ | ||
| jq -r ' |
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.
What is the necessity of piping output of shellcheck to jq
?
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 to replace some keys like column
and values like info
and style
with github action command.
col
and notice
in this case.
And to format shellcheck's json as one-line command like ::error file=file.sh,col=123::message
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.
And the trick with grep is just to negate exit code :)
My point is to fix warnings first (which I plan to do anyway iteratively) and then don't ignore it anymore. I just don't want to break other people PRs with minor changes of quotes and exports here and there. I just hope code without warnings would help with adding new features and refactoring. |
Hello.
I would like to add shellcheck linter for install scripts.
To avoid messing with #3673 podman PR (and to not edit all scripts at once) this action only checks
install/_lib.sh
I'm willing to slowly add all other
*.sh
scripts too.Some trade-offs I made:
install/_lib.sh
but action runs on any**.sh
change.ensure_file_from_example()
excluded as kinda false-positive, pure bash solution won't be more readable I supposeWarnings from unmodified lib.sh are available in this PR
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.