Skip to content

Add cppcheck static analysis to CI workflow #35

@angeloINTJ

Description

@angeloINTJ

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

  1. 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
  2. Fix any existing warnings (or add suppressions with comments explaining why)
  3. Verify the CI passes: check GitHub Actions on your fork

Acceptance

  • cppcheck step added to build.yml
  • CI passes green with zero cppcheck errors
  • Any necessary suppressions have explanatory comments
  • Build time impact is under 30 seconds

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciContinuous integration and automationgood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions