From 61bda56530889b4acf6c935d832f219b6c0ebd83 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Tue, 15 Aug 2023 14:57:33 -0400 Subject: [PATCH] Let shellcheck handle good vs bad shell types This matches official shellcheck pre-commit hook at [1]. This works because shellcheck will silently skip "badShells" so there isn't a good reason to do this here. The old setup was actually causing pre-commit to skip shell scripts ending with .sh since both types *and* types_or were specified but the identified tags resulted in an empty set: $ cat t.sh echo hi $ nix-shell -p python3Packages.identify --run 'identify-cli t.sh' ["file", "non-executable", "shell", "text"] An argument could be had that 'sh' should have shown up due to the extension similar to other shells but I still believe we should merge this and match upstream. 1: https://github.com/koalaman/shellcheck-precommit/blob/v0.9.0/.pre-commit-hooks.yaml#L7 --- modules/hooks.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index 05c47244..9cb092df 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -1055,16 +1055,6 @@ in name = "shellcheck"; description = "Format shell files."; types = [ "shell" ]; - types_or = - # based on `goodShells` in https://github.com/koalaman/shellcheck/blob/master/src/ShellCheck/Parser.hs - [ - "sh" - "ash" - "bash" - "bats" - "dash" - "ksh" - ]; entry = "${tools.shellcheck}/bin/shellcheck"; }; bats =