Skip to content

Strengthen repository-wide quality gates - #20

Open
mmabdpr wants to merge 105 commits into
mainfrom
dev/code-quality-tooling
Open

mmabdpr wants to merge 105 commits into
mainfrom
dev/code-quality-tooling

Conversation

@mmabdpr

@mmabdpr mmabdpr commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Summary

Strengthens the repository-wide quality gates and fixes every finding they surface.
105 commits, 289 files.

Pinned tooling

  • tools/quality/toolchains.env records exact versions for clang, clang-tidy,
    clang-format, GCC, Python, Homebrew LLVM, Apple clang, and the .NET SDK, and
    each CI step calls require_version so a silent patch bump fails the job
    explicitly instead of drifting.
  • tools/quality/requirements.in / requirements.txt (hash-pinned),
    tools/quality/package.json / package-lock.json, and
    tools/quality/install_tools.sh give one reviewed source of truth for the
    lint and analysis stack; tools/quality.sh is the local entry point that
    runs the same checks CI runs.

clang-tidy

  • Enables the full modernize family and the google family, plus
    readability (identifier naming, declaration/definition readability,
    header guards, judgment checks), cppcoreguidelines for the fixed subset,
    and the mechanical checks, with exceptions documented in
    tools/quality/clang-tidy-tests.yaml and the docs.
  • tools/clang_tidy.py gains a self-test that proves checks are actually
    active, so a silently disabled check fails the gate.

CI and CodeQL gates

  • New Quality workflow: source/config hygiene matrix on Linux x86_64,
    Linux arm64, and macOS 15; Markdown, formatting, embedded-Python and
    documentation checks; fail-closed guard scripts
    (tools/check_ci_guards.py, tools/check_config.py,
    tools/check_embedded_python.py, tools/check_docs.py).
  • CodeQL workflow extended to require zero open alerts via
    tools/check_codeql_alerts.py, so a new alert fails the job instead of
    being ignored.
  • ci.yml, macos.yml, and release.yml updated to install and verify the
    pinned toolchains and to run the new gates; Bazelisk install action hardened.

Dependency audits

  • .github/dependabot.yml covers GitHub Actions (both roots), the Rust
    bindings/examples/bench workspaces, npm and pip for tools/quality, and
    NuGet for the C# bindings, each with a 7-day cooldown.

Cross-language fixes

  • C/C++: goto-free kernel state dispatch, type-safe formatting instead of
    varargs, std::span-based views instead of pointer arithmetic, named magic
    numbers, cognitive-complexity decomposition across production code, tests,
    examples, benchmarks, and the CBMC harnesses, and generated kernel
    identifiers/guards made readable.
  • Python: embedded-Python checks, bench_summary, summarize_large_compare,
    release, and clean_shm_sidecars brought under the new gates.
  • Rust/C#/docs: formatting, packaging, and documentation fixes required by the
    new checks.

Test plan

  • CI green on the pushed head
  • macOS CI green on the pushed head
  • Quality green on the pushed head
  • CodeQL green on the pushed head

Enable whole clang-analyzer, bugprone, cert, concurrency, misc,
performance, and portability families with named exclusions. Fix the
actionable findings across C/C++ bindings, tests, examples, and
benchmarks, and allow the clang-analyzer-optin namespace in typos.
# Conflicts:
#	bindings/c/src/mpmc_shm.c
#	bindings/cpp/include/mpmc/shm_fluent.hpp
Rename the ping-pong diagnostic buffers so they no longer shadow the
mpmc_shm_status error variable, and fix the related review findings:

- qualify control_region errno formatting to the free large_compare::error_text
  so shm_open/ftruncate/mmap failures keep their strerror text instead of
  resolving to the member that reads the control region
- replace std::error_code-based error_text with a direct strerror_r helper in
  stats.h and bench_common.h, handling the GNU and XSI signatures explicitly
- flush stdout and stderr before _Exit in the RESP and NATS comparator die()
  paths so buffered header lines are not lost
Enable readability-implicit-bool-conversion, make-member-function-const,
convert-member-functions-to-static, avoid-nested-conditional-operator, and
use-anyofallof.

The implicit bool conversions are explicit comparisons or `? 1 : 0`
returns in the shared C headers.  The constant weak argument of the atomic
compare-exchange builtins keeps a line-local NOLINT because C11 has no
bool literal and `_Bool` cannot be named in both C and C++.

The reported member functions are const or static, the nested unit/kind
ternaries became if/else chains or a kind_name helper, and the two needle
loops use std::ranges::all_of with the same predicates.

readability-function-cognitive-complexity stays disabled because the
generated kernel.inc contains one finding that only the kernel generator
can change.
Render the queue parameter as queue, virtual registers as reg0..regN, one register declaration per line, guarded-goto branches with an explicit fall-through, and the path-derived MPMC_DETAIL_KERNEL_INC guard. Wrap each entry point in a NOLINTBEGIN/NOLINTEND pair so the wrapped ABI parameter list stays audited. Update the kernel digest, the stripped-diagnostic expectations, and the documentation.
Rename the 580 readability-identifier-length sites across the C and C++ API, tests, benchmarks, examples, and verification harnesses; split the remaining multi-declarations; and add stable guards plus audit notes for llvm-header-guard. Update the clang-tidy configuration, the reviewed include-cleaner line map, and the quality documentation. readability-function-cognitive-complexity remains disabled because 136 pre-existing functions still exceed the threshold.
Enable readability-function-cognitive-complexity and split the C ABI and fluent drain paths into named, behavior-preserving helpers.
Split long scenario bodies and callbacks into named verification helpers; behavior and ordering are unchanged.
Enable 36 cppcoreguidelines checks, fix their findings, and add one active probe per enabled check to tools/clang_tidy.py. Keep avoid-goto, avoid-magic-numbers, pro-bounds-pointer-arithmetic, and pro-type-vararg deferred with measured counts and documented reasons.
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Use the declared non-Apple locals in mpmc_shm.c, raise the kernel_fifo unwind bound to the smallest passing value, add platform/toolchain-keyed include-cleaner baselines with Linux diagnostics taken from the hosted log, source tools/quality/toolchains.env in the macOS Rust step, and accept absent/null SARIF status.errors as empty in the CodeQL gate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants