diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2e27e78 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + +# See https://tmt.readthedocs.io/en/latest/guide.html#checking-data-validity +- repo: https://github.com/teemtee/tmt.git + rev: 1.32.2 + hooks: + - id: tmt-lint + +- repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.10.0 + hooks: + - id: shellcheck + require_serial: true # Podman has trouble running concurrently + args: ["--exclude=SC1091"] # Ignore "Not following" sourced scripts diff --git a/tests/lldb-std-vector-prettyprint/test.sh b/tests/lldb-std-vector-prettyprint/test.sh index d6740ad..9a58e17 100755 --- a/tests/lldb-std-vector-prettyprint/test.sh +++ b/tests/lldb-std-vector-prettyprint/test.sh @@ -12,10 +12,11 @@ lldb -b -o 'breakpoint set --file test.cpp --line 7' -o run -o 'p v' -- a.out | # (std::vector >) $0 = size=1 { # [0] = 2 -test `grep \ +# shellcheck disable=SC2016 +test "$(grep -c \ -e '(std::vector \)\?>) \($0 = \)\?size=1 {' \ -e '\[0\] = 2' \ lldb.log \ - | wc -l` -eq 2 + )" -eq 2 rm lldb.log diff --git a/tests/python-embedded-interpreter/test.sh b/tests/python-embedded-interpreter/test.sh index ca9e7e6..eef7ebb 100755 --- a/tests/python-embedded-interpreter/test.sh +++ b/tests/python-embedded-interpreter/test.sh @@ -1,7 +1,7 @@ #!/bin/sh -eux # Verify the formal side of things, lldb should really depend on its Python bits -LLDB_PACKAGE=${LLDB_PACKAGE:-$(rpm -qf $(which lldb))} +LLDB_PACKAGE=${LLDB_PACKAGE:-$(rpm -qf "$(which lldb)")} rpm -q --requires "$LLDB_PACKAGE" | grep python3-lldb # Sanity test @@ -11,10 +11,11 @@ lldb -b -o 'breakpoint set --file test.cpp --line 8' \ -o run -o 'p i' -o 'p f'\ -- a.out | tee lldb.log -test `grep \ +# shellcheck disable=SC2016 +test "$(grep -c \ -e '(int) \($0 = \)\?1' \ -e '(float) \($1 = \)\?1' \ lldb.log \ - | wc -l` -eq 2 + )" -eq 2 rm lldb.log