cert-review
v1.4.4SEI CERT C/C++ code review: rule lookup, clang-tidy and cppcheck findings mapped to CERT rules
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_rules List coding-standard rules by filter
List rules from the bundled databases, filtered by standard, language, category, kind, risk level, CERT detectability, MISRA/AUTOSAR classification or checker coverage. Default standard is SEI CERT C/C++ (388 rules and recommendations); standard='misra' or 'autosar' lists MISRA C:2012 (221), MISRA C++:2023 (178) or AUTOSAR C++14 (397) guidelines. Use to enumerate rules by structured criteria, e.g. all L1 C++ rules no checker detects or all mandatory MISRA C rules. Do not use for free-text lookup (use search_rules) or one rule's details (use get_rule). Reads bundled data only; fast. Returns sum…
| Parameter | Type | Description |
|---|---|---|
category | string | SEI CERT three-letter category, e.g. EXP expressions, MEM memory, INT integers, STR strings, CON concurrency. Ignored for other standards' sections. |
classification | string | MISRA/AUTOSAR classification; SEI CERT rules have none and are excluded when this is set. |
coverage | string | Checker coverage tier: deterministic = a rule-specific checker exists; partial = only general checkers; llm-only = no checker, manual review needed. Matches either the all-mappings or the pinned-toolc… |
detectable | CERT's own 'Detectable' flag (true = automatable in principle). Omit for both. | |
kind | string | rule = normative rule; recommendation = CERT advisory (C only); directive = MISRA directive. |
lang | string | c = C rules (SEI CERT C, MISRA C), cpp = C++ rules (SEI CERT C++, MISRA C++, AUTOSAR). |
level | string | CERT priority level; L1 is the most urgent. |
limit | integer | Maximum summaries returned (each ~400 bytes). |
standard | string | Rule set: cert = SEI CERT C and C++ (default; the only standard with full rule text); misra = MISRA C:2012 (with Amendments 1-4, i.e. the MISRA C:2023 set) and MISRA C++:2023; autosar = AUTOSAR C++14;… |
search_rules Search coding-standard rules by keyword
Rank rules by keyword relevance to a free-text query: API names (strcpy, malloc, pthread_mutex_lock), concepts (integer overflow) or a rule ID in any accepted form (EXP34-C, misra-c2012-10.4, A5-2-2). Searches SEI CERT C/C++ by default; set `standard` for MISRA or AUTOSAR, where only our one-line summaries, section names and facts are searchable (plus licensed texts when loaded). Use when you know what the code does but not which rule applies. Do not use for structured filters (use list_rules) or to read a rule (use get_rule). Case-insensitive term counting, not semantic search; 1-character to…
| Parameter | Type | Description |
|---|---|---|
query * | string | Keywords separated by spaces; title hits weigh 8x body hits. |
lang | string | Restrict to C (c) or C++ (cpp) rules. |
limit | integer | Maximum results. |
standard | string | Rule set: cert = SEI CERT C and C++ (default; the only standard with full rule text); misra = MISRA C:2012 (with Amendments 1-4, i.e. the MISRA C:2023 set) and MISRA C++:2023; autosar = AUTOSAR C++14;… |
get_rule Get one coding-standard rule
Return the full record of one rule. SEI CERT: text, noncompliant and compliant code examples, exceptions, risk assessment, CWE IDs, related MISRA/AUTOSAR guidelines (cross_references), the checkers that detect it, and how the profile adjusts or disables it. MISRA/AUTOSAR: classification, section, enforcement, related CERT rules, checkers and our one-line summary; the official text appears only when the user loaded a licensed rule-texts file (text_source, quote_required). Use before judging or explaining a finding, or to copy the verbatim `quote` validate_findings requires. Do not use to discov…
| Parameter | Type | Description |
|---|---|---|
rule_id * | string | Rule ID, case-insensitive. SEI CERT: category, two digits, -C or -CPP (EXP34-C). MISRA C:2012: MISRA-C-2012-<n.n> or MISRA-C-2012-DIR-<n.n>. MISRA C++:2023: MISRA-CPP-2023-<n.n.n> (DIR- for directives… |
include_examples | boolean | Include code examples in `text` and `examples`. |
profile | string | Review profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml… |
get_rule_coverage Summarize checker coverage per standard
Count rules per detection tier: deterministic (a rule-specific checker exists, e.g. a clang-tidy cert-* alias or the cppcheck MISRA addon), partial (only general checkers map) and llm-only (no checker; manual review needed), for all checker mappings, for the pinned reference toolchain (clang-tidy and Clang Static Analyzer 19.1.7, cppcheck 2.17.1, Semgrep with the bundled rules) and for the extended toolchain (plus Infer and the CodeQL CERT packs). SEI CERT by default; set `standard` for MISRA or AUTOSAR (adds by_standard and licensed_texts). Use to judge how much of a review static analysis ca…
| Parameter | Type | Description |
|---|---|---|
include_ids | boolean | Add rules_all_mappings, rules_runnable and rules_extended: rule ID lists per tier (~15 KB). |
kind | string | Count only rules, CERT recommendations or MISRA directives. |
lang | string | Count only C (c) or C++ (cpp) rules. |
standard | string | Rule set: cert = SEI CERT C and C++ (default; the only standard with full rule text); misra = MISRA C:2012 (with Amendments 1-4, i.e. the MISRA C:2023 set) and MISRA C++:2023; autosar = AUTOSAR C++14;… |
check_files Check C/C++ files for coding-standard violations
Run clang-tidy, the Clang Static Analyzer and cppcheck (plus Semgrep and Infer when installed, CodeQL on request; see `tools`) on a C/C++ file or a directory (recursive) and return every finding mapped to SEI CERT rule IDs, or to MISRA C:2012 / MISRA C++:2023 / AUTOSAR C++14 IDs when `standards` (or the profile) selects them; MISRA C adds the cppcheck MISRA addon on .c files. Use for whole-file or whole-tree audits; for a change set use check_diff, which keeps only changed lines. Runs the analyzers as local subprocesses (4 in parallel, 300 s timeout per file and tool) and writes no files. Take…
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path of a C/C++ file or a directory to scan recursively. Files are picked by the profile's extensions and exclude_paths. |
baseline_path | Absolute path of a baseline JSON written by `cert-review baseline create`. Findings recorded there are left out and counted in `baseline`; file paths in it are relative to its directory. Matching uses… | |
compdb | Absolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root… | |
include_suppressed | boolean | Also return findings hidden by the profile or by `// cert-review: ignore <RULE>` comments, each with its suppression reason (for audits). |
lang | string | Analyse only .c files (c) or only C++ files (cpp). |
min_confidence | number | Drop findings below this confidence. Rule-specific checkers score 0.9, general checkers 0.3-0.65, +0.1 when two tools agree. 0.5 keeps most real hits. |
profile | string | Review profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml… |
root | Absolute project root: adds root/src, root/include and similar as include paths, enables compdb auto-detection, and is the base for the profile's path globs. | |
standards | Standards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ fi… | |
tools | Analyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = sta… |
check_diff Check changed C/C++ lines for coding-standard violations
Run the check_files analyzers on the C/C++ files of a change and keep only findings on added or modified lines, mapped to the same standards (`standards` or the profile; SEI CERT by default). The change is `base`..`head` in the git repo at `repo`, `base` against the working tree when head is omitted, or a pasted unified diff (`diff_text`, paths relative to repo). Use for pull-request or pre-commit review; for whole files use check_files. Runs `git diff` and the analyzers locally; writes nothing. For git refs, files must exist at `head` or line numbers will not match. With `diff_text`, files ar…
| Parameter | Type | Description |
|---|---|---|
repo * | string | Absolute path of the git checkout; diff paths are resolved against it. |
base | Base git ref (branch, tag or SHA). Required unless diff_text is given. | |
baseline_path | Absolute path of a baseline JSON written by `cert-review baseline create`. Findings recorded there are left out and counted in `baseline`; file paths in it are relative to its directory. Matching uses… | |
compdb | Absolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root… | |
diff_context | integer | Also report findings within this many lines of a changed line (confidence scaled by 0.85). |
diff_text | Unified diff text (git diff format, a/ b/ prefixes allowed). Overrides base and head. | |
head | Head git ref. Omit to compare base with the working tree (uncommitted changes included). | |
include_suppressed | boolean | Also return findings hidden by the profile or by `// cert-review: ignore <RULE>` comments, each with its suppression reason (for audits). |
min_confidence | number | Drop findings below this confidence. Rule-specific checkers score 0.9, general checkers 0.3-0.65, +0.1 when two tools agree. 0.5 keeps most real hits. |
profile | string | Review profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml… |
standards | Standards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ fi… | |
tools | Analyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = sta… |
explain_finding Explain a SEI CERT finding and suggest a fix
Explain one finding: a short rule summary, why the finding matches the rule (checker mapping, APIs, shared identifiers), the rule's noncompliant/compliant example pair most similar to the flagged code (token overlap), a unified diff between them, and concrete fix steps derived from that compliant example plus per-API and per-category advice. Use after check_files or check_diff when you need to explain or fix a finding; pass the finding object unchanged, or rule_id with file and line, or with a code snippet. Use get_rule instead for the full rule text and all examples, and validate_findings (no…
| Parameter | Type | Description |
|---|---|---|
finding * | The finding: an item of check_files/check_diff `findings` as is, or {rule_id, file, line} or {rule_id, code}. | |
context_lines | integer | Lines shown around the flagged line in finding.snippet (and used as fallback tokens when the line is blank). |
profile | string | Review profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml… |
build_review_packet Build a SEI CERT review packet
Build a packet for reviewing code against SEI CERT rules that analyzers cannot decide: code hunks, each with up to max_rules_per_hunk candidate rules (picked by token/API heuristics and profile idioms, rules fully covered by a specific checker left out) and their text excerpts. Diff mode (`repo` plus `base` or `diff_text`): changed lines with 3 lines of context. Path mode (`path`): whole files. Hunks are cut into 60-line windows. Use after check_diff or check_files; judge each hunk, then send your findings to validate_findings. Read-only; run_static=true also runs the analyzers (same cost as c…
| Parameter | Type | Description |
|---|---|---|
base | Diff mode: base git ref; required with repo unless diff_text is given. | |
compdb | Absolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root… | |
diff_context | integer | Lines around a change to include in static analysis (confidence * 0.85). |
diff_text | Diff mode: unified diff text, paths relative to repo. | |
head | Diff mode: head git ref; omit for the working tree. | |
max_rules_per_hunk | Candidate rules per hunk. Omit to use the profile's value (6 in both bundled profiles). | |
min_confidence | number | Minimum confidence for bundled static analysis when run_static is true. |
path | Path mode: absolute path of a file or directory. Ignored when diff mode applies. | |
profile | string | Review profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml… |
repo | Diff mode: absolute path of the git checkout. | |
run_static | boolean | Also run the analyzers and list their findings per hunk so they are not repeated. Set false if you already ran check_diff/check_files. |
standards | Standards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ fi… | |
tools | Analyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = sta… |
validate_findings Validate manual SEI CERT findings
Accept or reject findings written from a build_review_packet review, with reasons. A finding passes only if its rule_id exists (C++ rules are rejected on .c files, MISRA C rules on C++ files), its quote is a passage of 20+ characters found in that rule's text or examples (case, whitespace, curly quotes and markdown are normalised; MISRA/AUTOSAR need a quote only when a licensed rule-texts file is loaded, otherwise accepted findings carry grounding='rule-id-only'), it has a file, a line >= 1 and a message, and the profile does not disable the rule. With `packet`, the line must also fall inside…
| Parameter | Type | Description |
|---|---|---|
findings * | array | Findings to check; an empty list is valid. |
packet | The build_review_packet result (or just {hunks}) to enforce hunk and candidate-rule bounds. Strongly recommended. | |
profile | string | Review profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml… |
format_pr_review Draft PR comment with hints and style nits
Build a single markdown PR comment from `check_diff` output and `build_review_packet`: static tool summary, heuristic candidate-rule table, Ceph idiom hints, CodingStyle nits, and optional functional bullets. Does not post anywhere.
| Parameter | Type | Description |
|---|---|---|
check_result | Full object returned by check_diff (tools, findings, warnings, summary). | |
functional_notes | Extra functional review bullets; omit to auto-suggest from packet code. | |
github_footer | Append collapsible footer: pull_request_target, mcp, or github-action. Omit to skip. | |
packet | Result from build_review_packet (needs `hunks`). | |
profile | string | Review profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml… |
root | Repo root for relative paths in the markdown. | |
scope | One line: merge-base..head and file list. | |
title | Heading for the comment, e.g. the PR title. |
review_pr Review a PR change (static + hints + draft comment)
Run check_diff on `base`..`head`, build_review_packet for heuristic hints, and format_pr_review into one markdown comment (static table, candidate rules, idioms, style nits, functional bullets). Does not post. Prefer this over three separate calls. profile ceph auto-builds synthetic compdb when needed.
| Parameter | Type | Description |
|---|---|---|
base * | string | Base git ref (merge-base or target branch SHA). |
repo * | string | Absolute path of the git checkout. |
baseline_path | Absolute path of a baseline JSON written by `cert-review baseline create`. Findings recorded there are left out and counted in `baseline`; file paths in it are relative to its directory. Matching uses… | |
compdb | Absolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root… | |
diff_context | Omit to use profile default (ceph: 3). | |
functional_notes | Extra functional bullets for the comment. | |
github_footer | Append collapsible footer: pull_request_target, mcp, github-action. Omit when drafting for manual paste. | |
head | Head ref (PR branch). Default: working tree. | |
min_confidence | number | Drop findings below this confidence. Rule-specific checkers score 0.9, general checkers 0.3-0.65, +0.1 when two tools agree. 0.5 keeps most real hits. |
profile | string | Review profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml… |
scope | Optional scope line; auto-generated when omitted. | |
standards | Standards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ fi… | |
title | PR title for the comment heading. | |
tools | Analyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = sta… |
format_findings Format SEI CERT findings as a report
Render findings as a report or review payload without sending it. style: markdown (string); github (object for POST /repos/{owner}/{repo}/pulls/{n}/reviews, event COMMENT, one comment per finding); gitlab (array of merge-request discussion bodies; position SHAs are placeholders to fill from diff_refs); sarif (SARIF 2.1.0 object); codequality (GitLab Code Quality array); gitlab-sast (GitLab SAST report object). Use as the last step, then show drafted comments to the user before anyone posts them. Pass findings unchanged from check_files/check_diff `findings` or validate_findings `accepted`. Pur…
| Parameter | Type | Description |
|---|---|---|
findings * | array | Findings exactly as returned by check_files, check_diff (findings) or validate_findings (accepted). |
root | Absolute repository root; file paths in the output are made relative to it. Omit and paths become relative to the server's working directory. | |
style | string | Output format; see the tool description for each shape. |
warnings | `warnings` from check_files/check_diff; shown as a partial-analysis notice in markdown, github and sarif. |