Checking 4 spaces indent in C files in CI
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 276
- Forks
- 200
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 7
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the CI setup and the C sources under ext/openssl/, using the proposed check_no_tab.sh pattern as the starting point. Confirm the check reports tab-containing lines and passes when no tabs are present; done means the check runs in CI for the C files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, c
- Domain
- ci-cd
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- Half a day
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100