Skip to content
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

[MISC] Add shellcheck checks to ensure that those few shell scripts we have are "robust" #1774

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
yarikoptic marked this conversation as resolved.
Show resolved Hide resolved
name: Shellcheck

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
shellcheck:
name: Check shell scripts
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update && sudo apt install -y shellcheck
- name: shellcheck
run: |
git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' | xargs shellcheck
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
skip: [shellcheck]
exclude: 'tools/schemacode/bidsschematools/tests/data/broken_dataset_description.json'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -64,3 +66,7 @@ repos:
- types-tabulate
args: ["tools/schemacode/bidsschematools"]
pass_filenames: false
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.9.0
hooks:
- id: shellcheck
2 changes: 1 addition & 1 deletion scripts/test_tag
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
EPOCH="$(date +%s)"

GIT_DIR=$( git rev-parse --git-dir )
REPO_ROOT=$( ls -d ${GIT_DIR%.git} )
REPO_ROOT=$( ls -d "${GIT_DIR%.git}" )

VERSION_FILE="$REPO_ROOT/src/schema/SCHEMA_VERSION"

Expand Down
Loading