What
Add a cppcheck step to .github/workflows/build.yml to catch bugs at CI time.
Why
cppcheck is a lightweight, zero-config static analyzer for C/C++. It catches:
- Buffer overflows
- Memory leaks
- Null pointer dereferences
- Uninitialized variables
- Suspicious expressions
For a firmware project handling network input, this is a critical safety net.
How
- Add new steps after "Set up Python" in
.github/workflows/build.yml:
- name: Install cppcheck
run: sudo apt-get update && sudo apt-get install -y cppcheck
- name: Static Analysis
run: |
cppcheck --enable=all --inconclusive --error-exitcode=1 \
-I src/ --suppress=missingIncludeSystem \
--suppress=unusedFunction \
src/ 2>&1 | tee cppcheck.log
- Fix any existing warnings (or add suppressions with comments explaining why)
- Verify the CI passes: check GitHub Actions on your fork
Acceptance
References
What
Add a
cppcheckstep to.github/workflows/build.ymlto catch bugs at CI time.Why
cppcheck is a lightweight, zero-config static analyzer for C/C++. It catches:
For a firmware project handling network input, this is a critical safety net.
How
.github/workflows/build.yml:Acceptance
cppcheckstep added tobuild.ymlReferences
.github/workflows/build.yml— existing CI workflow