Skip to main content

Config-driven MISRA C:2023 static-analysis harness for arbitrary C projects (cppcheck-backed, bring-your-own rule texts).

Project description

misch

CI PyPI Python License: MIT

Point misch at a C project and ratchet it toward MISRA C:2023. It is a configuration-driven harness around cppcheck and its misra.py addon. A compilation database describes the real build; misra.toml describes the analysis boundary and project policy.

  • Explicit scope: every compilation unit is analysed or deliberately excluded.
  • Baseline ratchet: existing findings remain visible while CI rejects new ones.
  • Deviation records: suppressions require justification and can be audited for staleness.
  • Bring-your-own rule texts: no copyrighted MISRA material is bundled.

misch is an adoption and guidance tool, not a compliance-certification tool. cppcheck's addon implements only a subset of MISRA C:2023 checks.

Install

Python 3.11 or later and cppcheck with its bundled misra.py addon are required. cppcheck must be available on PATH.

uv tool install misch

Alternatively, use pipx install misch or pip install misch. From a checkout, use uv sync and prefix commands with uv run.

Quick start

Run these commands from the root of the C project:

misch init --scaffold  # create misra.toml and a documented analysis/ tree
misch run              # report findings; exit 1 when findings are present
misch baseline         # explicitly accept the current finding counts
misch run --baseline   # report everything; exit 1 only for new findings
misch deviations       # validate suppressions and their justifications

Use misch init without --scaffold when only a configuration file is wanted. Review the generated scope, exclusions, and compilation-database source before the first run.

Rule headlines and Mandatory, Required, or Advisory categories are optional. Supply them from a licensed MISRA document through a cppcheck-format file:

export MISRA_RULE_TEXTS=/secure/path/misra-headlines.txt

Analysis still runs without that file and labels categories as unknown. See Rule texts for format and licensing guidance.

Commands

Command Purpose
misch init Generate a documented misra.toml; add --scaffold for the recommended analysis asset tree.
misch run Analyse and render terminal, JSON, or SARIF results. Add --baseline to fail only on findings above accepted counts.
misch baseline Analyse and store the current finding counts as the accepted baseline.
misch deviations Validate inline and project suppressions; optionally emit a Markdown deviation record or check staleness.

Run misch COMMAND --help for command options.

Exit codes are format-independent:

  • 0: clean, no new baseline findings, or valid deviations;
  • 1: findings, new baseline findings, or invalid deviations;
  • 2: configuration, scope, compilation-database, initialization, or engine error.

Configuration

misch reads misra.toml from the current working directory unless -c PATH is supplied. It does not search parent directories. Relative configuration paths are resolved from the selected file's directory.

A minimal configuration looks like this:

[project]
scope = ["src/", "include/"]
exclude = ["tests/", "vendor/"]

[db]
source = "existing"
path = "build/compile_commands.json"

[platform]
preset = "unix64"

[rules]
texts = "${MISRA_RULE_TEXTS}"

See the Configuration reference for all sections, path rules, report formats, baselines, deviations, and initialization behavior.

Scaffold layout

misch init --scaffold creates:

project-root/
├── misra.toml
└── analysis/
    ├── README.md
    ├── rules/README.md
    ├── deviations/misra-deviations.txt
    └── baseline/README.md

The configuration points at the deviations template and the future baseline path. Initialization creates neither licensed rule text nor a baseline acceptance file. If any generated target already exists, the command writes nothing unless --force is supplied; --force replaces every generated regular file.

Documentation

License

misch is distributed under the MIT License. It contains no MISRA guideline text; users must source and handle any rule-text file according to their own licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

misch-0.2.0.tar.gz (60.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

misch-0.2.0-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file misch-0.2.0.tar.gz.

File metadata

  • Download URL: misch-0.2.0.tar.gz
  • Upload date:
  • Size: 60.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for misch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4a92547bff68dddf1388228150fbd54ebd00bff62f5633e3e15c6c132e455d47
MD5 e38838712f110820e7b17b616d50db6d
BLAKE2b-256 b9c6c48e2c4d5afb65357137d30ee838044406ecb647364930a768d0e3947a1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for misch-0.2.0.tar.gz:

Publisher: release.yml on aajll/misch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file misch-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: misch-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for misch-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57af2aac0dc65a2bd6191a60eef382a9dcf073e0ee1658f5c29923251ddb7457
MD5 042fc7a408caf9b3d27eddc347137b4d
BLAKE2b-256 e78bb87d275edec212ef8d8bdc84c23fa5b95ac64ecb9c180d110e2cad55cdab

See more details on using hashes here.

Provenance

The following attestation bundles were made for misch-0.2.0-py3-none-any.whl:

Publisher: release.yml on aajll/misch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page