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

Add shellcheck and pre-commit to CI jobs #3002

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bf588a2
add shellcheck and pre-commit to CI jobs
terhorstd Nov 21, 2023
bb00bbf
Merge remote-tracking branch 'upstream/master' into add-shellcheck-pr…
terhorstd Jan 21, 2025
aed74c6
enable checking more file formatting issues
terhorstd Jan 21, 2025
6e0e5c4
reformatted whitespaces and newlines
terhorstd Jan 21, 2025
ac35773
fixed numerous quotes and plain bugs found by shellcheck
terhorstd Jan 21, 2025
d9e7231
add shellcheck, pre-commit-hooks and cppcheck as build prerequisites
terhorstd Jan 21, 2025
12d79b4
add CI check for Windows line endings CRLF
terhorstd Jan 21, 2025
8fddc68
fix run_examples search mechanism
terhorstd Jan 21, 2025
42765f6
attempt to fix missing shellcheck input file
terhorstd Jan 21, 2025
6f1b088
fix return code of check_forbidden_types.sh
terhorstd Jan 21, 2025
6678863
try argument with koalaman/shellcheck-precommit
terhorstd Jan 21, 2025
9286262
notice incoherent shellcheck file lists
terhorstd Jan 21, 2025
24d4a39
fix typo
terhorstd Jan 22, 2025
26456a7
fix undefined variable in junit_xml.sh
terhorstd Jan 22, 2025
ff38aad
partial pre-commit autoupdate
terhorstd Jan 22, 2025
a69ce17
improved comment
terhorstd Jan 22, 2025
f7e9464
add workaround for missing 'find -printf' on MacOS
terhorstd Jan 22, 2025
4ea5f00
added extra explanation for future me
terhorstd Jan 22, 2025
9571b05
Fix typo in comment
heplesser Jan 22, 2025
cd2484c
more fixes of shell quoting and escaping for install scripts
terhorstd Jan 30, 2025
a8fa1a9
Merge remote-tracking branch 'refs/remotes/origin/add-shellcheck-prec…
terhorstd Jan 30, 2025
efdf4c8
Merge remote-tracking branch 'upstream/master' into add-shellcheck-pr…
terhorstd Jan 30, 2025
6f937eb
change quoting and reporting of library install paths
terhorstd Jan 30, 2025
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
3 changes: 2 additions & 1 deletion .github/workflows/nestbuildmatrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ jobs:
# formatting in their editor consistently.
# https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#mixed-line-ending
#
# This check makes sure the repository is always consistent NL line endings.
# This check makes sure the files in the repository are always consistent
# in their line endings, i.e. new line, and not carrige return+line feed.
heplesser marked this conversation as resolved.
Show resolved Hide resolved
runs-on: "ubuntu-20.04"
steps:
- name: "Checkout repository content"
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand Down
9 changes: 8 additions & 1 deletion testsuite/do_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@ list_files() {
# instead use list_files like
#
# list_files <somedir> <some_pattern> | while read -r test_name; do ... done
find "${1}" -maxdepth 1 -name "${2}" -printf '%f\n'
if test "${INFO_OS}" = "Darwin"; then
# ref https://stackoverflow.com/a/752893
# Note that on GNU systems an additional '-r' would be needed for
# xargs, which is not available here.
find "${1}" -maxdepth 1 -name "${2}" -print0 | xargs -0 -n1 basename
else
find "${1}" -maxdepth 1 -name "${2}" -printf '%f\n'
fi
}

echo "================================================================================"
Expand Down
7 changes: 4 additions & 3 deletions testsuite/junit_xml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ junit_write ()
bail_out 'junit_write: report file not open, call junit_open first!'
fi

if test -z "$1" -o -z "$2"; then
if test -z "$1" -o -z "$2"; then # Note: this aborts due to "undefined variable", not because of `-z`
bail_out 'junit_write: classname and testname arguments are mandatory!'
fi

Expand All @@ -126,8 +126,9 @@ junit_write ()
fi

if test "$3" = "failure" ; then
echo " <failure message=\"$4\" type=\"\"><![CDATA["
echo "${5/]]>/]]>]]\&gt;<\![CDATA[}"
msgdata="${5:-}"
echo " <failure message=\"${4:-}\" type=\"\"><![CDATA["
echo "${msgdata/]]>/]]>]]\&gt;<\![CDATA[}"
echo "]]></failure>"
fi
echo " </testcase>"
Expand Down
Loading