Skip to main content

misch

CI PyPI Python License: Apache-2.0

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. With no --db option, initialization detects one root-level Meson, CMake, or existing compilation-database candidate; it fails without writing if the choice is absent or ambiguous. Use --db (and --db-path for an existing database) to choose explicitly. 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.

By default, terminal output shows a rule table and summary. Add -v/--verbose to also print cppcheck's per-location diagnostics (colour-coded by severity) above the table.

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 -v/--verbose for a per-location cppcheck diagnostics listing. Add --baseline to fail only on findings above accepted counts. Use --profile <name> to select a platform overlay.
misch baseline Analyse and store the current finding counts as the accepted baseline. Use --profile <name> to select a platform overlay.
misch deviations Validate inline and project suppressions; optionally emit a Markdown deviation record or check staleness. Use --profile <name> to select a platform overlay.

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}"

For a multi-platform project, put platform-specific overrides under a profile and select it for analysis:

misch run --profile aarch64

--profile selects a configuration overlay that already exists in the file; it does not set a cppcheck platform directly. Give each ratcheted profile its own baseline.path, since findings differ between platforms.

See the Configuration reference for all sections, including profile overlays, 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 Apache License 2.0. It contains no MISRA guideline text; users must source and handle any rule-text file according to their own licence.

Metadata

Release files for misch 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for misch 0.4.0
File Size Uploaded Provenance Actions
misch-0.4.0.tar.gz 81.8 kB With provenance Details for misch-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for misch 0.4.0
File Interpreter ABI Platform Actions
misch-0.4.0-py3-none-any.whl Python 3 none any Details for misch-0.4.0-py3-none-any.whl

Total release size: 126.8 kB

Release files / misch-0.4.0.tar.gz

Download URL misch-0.4.0.tar.gz
Size 81.8 kB
Tags Source
SHA-256 checksum
How to use checksums
74169a7937ceb536d26d4027d941c64cd6f6bb3a6d95a5defd2c2c9b74923377
BLAKE2b-256 checksum
How to use checksums
1f1db246914b006939a865a9a126a13e338f204003423a1baa0985c8ca705d5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

Release files / misch-0.4.0-py3-none-any.whl

Download URL misch-0.4.0-py3-none-any.whl
Size 45.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8461a035a9754f8f22c0a2846927f64ec3a11f3aceab892ed21d51299d45ff86
BLAKE2b-256 checksum
How to use checksums
e2e9459efd23e5fd00c0d362ef32d21569fa8a9af202f53ce3926bc7f6ef8eac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

Security for misch 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for misch-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page