openssl
openssl copied to clipboard
Checking 4 spaces indent in C files in CI
Seeing the PR https://github.com/ruby/openssl/pull/973 (thanks for the PR!), I am considering if we can check if the indent is 4 spaces without tabs in CI. Right now I am seeing the following tools.
- clang-format: https://clang.llvm.org/docs/ClangFormat.html
- GNU indent: https://www.gnu.org/software/indent/
If we only check if C files don't include tabs. We may just apply the following kind of script.
$ cat check_no_tab.sh
#!/bin/bash
set -eu
if grep -rPn '\t' ext/openssl/; then
echo "FAIL"
exit 1
fi
echo "OK"
exit 0
OK case:
$ ./check_no_tab.sh
OK
Error case:
$ ./check_no_tab.sh
ext/openssl/ossl_ssl.c:3302: DefIVarID(hostname);
FAIL
What do you think?