From 3faff837ddd37476ae1e89efb89abb796a6a7d5d Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Fri, 13 Dec 2024 14:58:48 +0100 Subject: [PATCH] resources: grub: config: (ab)use shellcheck to check it. While the grub configuration file format is very different from real shell scripts, the similarities are enough to make it pass shellcheck with very few adjustements. The advantage of using shellcheck here is that we can still detect some issues such as variables that are referenced but not assigned. For instance if we add 'echo "$test"' in the beginning of the configuration file we then have: In resources/grub/config/grub.cfg line 24: echo "$test" ^---^ SC2154 (warning): test is referenced but not assigned (for output from commands, use "$(test ...)" ). Signed-off-by: Denis 'GNUtoo' Carikli Acked-by: Adrien 'neox' Bourmault --- resources/grub/config/grub.cfg | 4 ++++ tests/lint | 1 + 2 files changed, 5 insertions(+) diff --git a/resources/grub/config/grub.cfg b/resources/grub/config/grub.cfg index 511e4ce..08ba7c0 100644 --- a/resources/grub/config/grub.cfg +++ b/resources/grub/config/grub.cfg @@ -1,3 +1,4 @@ +# shellcheck disable=SC2148 # Does not check for #! # Copyright (C) 2013, 2024 Denis 'GNUtoo' Carikli # Copyright (C) 2013-2016, 2020-2021 Leah Rowe # Copyright (C) 2021 Vitali64 @@ -16,6 +17,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# shellcheck disable=SC2121 # warn against set var=val +# shellcheck disable=SC1036 # error: invalid '(' +# shellcheck disable=SC1088 # error: invalid uses of parentheses set prefix=(memdisk)/boot/grub insmod at_keyboard diff --git a/tests/lint b/tests/lint index df7b8a2..2f81b8a 100755 --- a/tests/lint +++ b/tests/lint @@ -46,6 +46,7 @@ run_shellcheck \ download \ modify \ update \ + resources/grub/config/grub.cfg \ resources/packages/coreboot/distclean \ resources/packages/descriptors/distclean \ resources/packages/grub/distclean \