From 1527d7fc25b6faed95886513402df036edcfe939 Mon Sep 17 00:00:00 2001 From: Piotr Semenov Date: Mon, 13 May 2024 00:24:20 +0400 Subject: [PATCH] chore: add shellcheck for bash scripts --- .pre-commit-config.yaml | 6 ++++++ scripts/compile-grammar.sh | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 60898bd..a8de58a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,7 @@ repos: entry: jsonlint language: system files: '.*\.(json|JSON-tmLanguage)' + exclude: ^(language-configuration|.vscode/launch).json # yaml - repo: local hooks: @@ -64,3 +65,8 @@ repos: entry: vagrant validate language: system files: 'Vagrantfile' + # shell + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.10.0 + hooks: + - id: shellcheck diff --git a/scripts/compile-grammar.sh b/scripts/compile-grammar.sh index c0eb869..07f41ae 100755 --- a/scripts/compile-grammar.sh +++ b/scripts/compile-grammar.sh @@ -6,12 +6,12 @@ set -e -scriptPath="$(readlink -f $0)" +scriptPath=$(readlink -f "$0") rootDir=$(dirname "${scriptPath%/*}") statix check nix flake check --impure "$rootDir" -cp $(nix build --impure \ - --no-link \ - --print-out-paths "$rootDir")/parigp* "$rootDir/syntaxes/" +cp "$(nix build --impure \ + --no-link \ + --print-out-paths "$rootDir")"/parigp* "$rootDir/syntaxes/"