Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Cppcheck

$ cppcheck Community Low Risk
Cppcheck · Code & DevOps · GPL-3.0 · macos / linux / windows

Offline static analyzer for C and C++ codebases targeting undefined behavior, null dereferences, memory leaks, and out-of-bounds access. Supports --enable=all, --project=compile_commands.json, and --xml structured diagnostics.

FCRS-1.0 Score
79 /100
Good
Medium Confidence
Zero-Friction Install
brew install cppcheck
CLI vs MCP Decision CLI Only

Runs local C/C++ dataflow analysis directly against workspace sources or compile_commands.json.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
✓ Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 17 / 25

Supports --xml --xml-version=2, --quiet, and --error-exitcode, but lacks native JSON and writes XML to stderr.

  • --xml-version=2 emits structured XML to stderr rather than stdout JSON
  • Requires --error-exitcode=1 to fail on findings
Trust & Safety 24 / 25

Strictly read-only static analyzer; never compiles or executes inspected C/C++ code.

  • Zero source modification and zero code execution
Setup & Portability 12 / 15

Available via Homebrew, Linux distro packages, and Windows installers, though accurate C++ scans rely on compile_commands.json.

  • Cross-platform native binary via brew and OS package managers
Utility & Efficiency 11 / 15

Catches real UB and resource leaks in C/C++, though --enable=all can be noisy without suppressions.

  • Supports --project=compile_commands.json and targeted check categories
Maintenance & Lineage 8 / 10

Long-lived community open-source project (cppcheck-opensource/cppcheck) with steady releases.

  • Maintained at cppcheck-opensource/cppcheck under GPL-3.0
Docs & Verifiability 7 / 10

Functional manual at cppcheck.sourceforge.io and detailed --help output.

  • Official HTML manual and CLI --help

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Offline local static analyzer; no credentials stored or required.

Side Effects
Read-Only
Cost & Quotas

GPL-3.0 open-source CLI; free to run locally.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Cppcheck Agent Rules
- Always pass `--quiet` and `--error-exitcode=1` when gating builds.
- Prefer `--project=compile_commands.json` over raw folder scans to minimize missing-include false positives.

Agent-Ready Command Recipes

Safe Read-Only Queries

Run Cppcheck with compile_commands.json and XML output
cppcheck --project=build/compile_commands.json --enable=warning,performance,portability --xml --xml-version=2 2> cppcheck.xml

Analyzes translation units using exact compiler flags and writes structured XML v2 diagnostics.

Quiet check on a single C++ directory
cppcheck --enable=warning,style --error-exitcode=1 --quiet src/

Suppresses progress noise with --quiet and fails with exit code 1 when issues are found.

Strengths for Agents

  • + 100% read-only C/C++ UB, memory-leak, and bounds analysis without executing target code.
  • + --project=compile_commands.json reuses exact build flags for higher precision.

Caveats & Pitfalls

  • ! No native --json flag; --xml writes diagnostics to stderr instead of stdout.
  • ! Running --enable=all without suppressions produces verbose style and missingInclude noise.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI