timescaledb/scripts/coccinelle.sh
Sven Klemm c91faad221 Add coccinelle workflow to CI
This patch adds a workflow to run coccinelle scripts against our
codebase. This can be used to find errors in the code base.
The initial patch adds a check to find unbalanced heap_form_tuple
heap_freetuple occurances.

https://coccinelle.gitlabpages.inria.fr/website/
2021-11-15 10:56:12 +01:00

13 lines
274 B
Bash
Executable File

#!/bin/sh
SCRIPT_DIR=$(dirname "${0}")
true > coccinelle.diff
for f in "${SCRIPT_DIR}"/../coccinelle/*.cocci; do
find "${SCRIPT_DIR}"/.. -name '*.c' -exec spatch --very-quiet -sp_file "$f" {} + | tee -a coccinelle.diff
done
if [ -s coccinelle.diff ] ; then exit 1; fi