Add static code checks to CI
We could wire certain tools, e.g. Coccinelle, into CI, in order to automatically detect certain shortcomings of the code being pushed to GitLab. The subject is fairly broad and thus this is basically just a placeholder issue.
A quick example:
-
Put the following contents into a file called
unreachable.spatch
.@@ @@ INSIST(0); + ISC_UNREACHABLE(); ... when != ISC_UNREACHABLE();
-
Invoke
spatch
(part of Coccinelle) e.g. like this, from the top-level directory of a working copy of the BIND repository:spatch --sp-file unreachable.spatch --dir . --very-quiet
The above will output (on standard output) a patch file which can be applied to the source tree in order to ensure all occurrences of INSIST(0);
are directly followed by an ISC_UNREACHABLE();
statement. In-place modification can be done with the help of the --in-place
switch, etc.