-
-
Notifications
You must be signed in to change notification settings - Fork 48
Add shellcheck script #641
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
Merged
liamwhite
merged 12 commits into
philomena-dev:master
from
MareStare:feat/add-shellcheck-linter
Nov 7, 2025
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
532506a
Add shellcheck script
MareStare 9fecea0
Fix shellcheck lints in `post-receiver`
MareStare fa49a43
Fix shellcheck lints in purge-cache and run-test
MareStare 48f7d3b
Add shellcheck installation script
MareStare 31c392e
Add shellcheck to the precommit hook. Don't handle non-existing tools…
MareStare 1af320f
Remove unnecessary $(repo)
MareStare 6cb1665
Remove post-receive as per Liam
MareStare a4e03ac
Make pre-commit hook sequential
MareStare d5ee3fd
Add shellcheck CI job
MareStare c733a65
Follow CI jobs naming pattern for shellcheck
MareStare 27e7545
Remove stray `&`
MareStare 78bd785
Fix small grammar mistake
MareStare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| #!/usr/bin/env sh | ||
| # shellcheck disable=SC2034 | ||
|
|
||
| # Run your custom purge command here. | ||
| # | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| . "$(dirname "${BASH_SOURCE[0]}")/../lib.sh" | ||
|
|
||
| version=0.11.0 | ||
|
|
||
| fetch https://github.com/koalaman/shellcheck/releases/download/v$version/shellcheck-v$version.linux.x86_64.tar.xz \ | ||
| | step tar -xJf - -C /usr/local/bin --strip-components=1 shellcheck-v$version/shellcheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # This script runs shellcheck on all shell scripts in the repository. | ||
| # It exists because shellcheck doesn't attempt to automatically discover | ||
| # shell scripts and requires specifying the file paths explicitly. | ||
| # | ||
| # This is somewhat understandable, because not all shell scripts use | ||
| # obvious file extensions like `.sh`. So, we discover such files by | ||
| # checking if they have one of the expected shebang lines at the beginning. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| . "$(dirname "${BASH_SOURCE[0]}")/lib.sh" | ||
|
|
||
| function shell_script_files { | ||
| git ls-files "*.sh" | ||
| git grep --files-with-matches '^#!/usr/bin/env bash' | ||
| git grep --files-with-matches '^#!/usr/bin/env sh' | ||
| } | ||
|
|
||
| mapfile -t files < <(shell_script_files "$@" | sort -u) | ||
|
|
||
| step shellcheck --source-path SCRIPTDIR "${files[@]}" | ||
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.
Uh oh!
There was an error while loading. Please reload this page.