Skip to content

ci+docs: CONTRIBUTING.md + clang-tidy workflow + .clang-tidy config - #2418

Open
ronaldtse wants to merge 2 commits into
mainfrom
coc-and-clang-tidy
Open

ci+docs: CONTRIBUTING.md + clang-tidy workflow + .clang-tidy config#2418
ronaldtse wants to merge 2 commits into
mainfrom
coc-and-clang-tidy

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Closes #1189 (Code of Conduct + community guidelines) and #2317 (Investigate GitHub Action static analysis tool).

CONTRIBUTING.md

The CoC already exists at docs/code-of-conduct.adoc (linked from README), but there was no CONTRIBUTING.md. This PR adds one covering the practical bits contributors actually need:

  • Build & test commands for both Botan and OpenSSL backends.
  • Code style (clang-format v11, .clang-format is the source of truth).
  • Commit message conventions (50/72, imperative mood, no AI-attribution trailers).
  • PR checklist (rebased, clang-format clean, tests pass on at least one backend, regression test for behaviour changes).
  • The crypto-path test discipline (assert output is encrypted, contains no plaintext key material).
  • How to add a new FFI function and a new CMake option (so future contributors don't have to reverse-engineer the patterns).

clang-tidy CI workflow + .clang-tidy config

  • Workflow .github/workflows/clang-tidy.yml: runs on push + PR, on clang-18 with both Botan and OpenSSL backends. Builds with CMAKE_CXX_CLANG_TIDY so clang-tidy runs per translation unit. Captures findings to the GitHub Step Summary (top-10 check categories) and uploads the full log as a 14-day artifact.
  • Config .clang-tidy: starts permissive — only a curated set of high-confidence checks (bugprone, cert subset, performance, modernize, readability). WarningsAsErrors is not enabled initially; the existing codebase has too many findings to flip the gate on all at once. The plan is to tighten incrementally per TODO.rnp-roadmap/20-static-analysis.md.
  • The workflow deliberately does not fail the build today — it surfaces findings for triage. Tightening to gate-on-fail is a follow-up once the existing findings are addressed.

Test plan

  • CONTRIBUTING.md renders correctly on GitHub.
  • clang-tidy workflow runs on a sample change and uploads the log artifact.
  • The curated check set produces a tractable volume of findings (not 10000+).

Out of scope (follow-up)

  • Tightening .clang-tidy check set after triaging initial findings.
  • Flipping WarningsAsErrors: '*' once clean.
  • The same pattern applied to Coverity (project already has a coverity.yml daily scan; could add PR-time gating once a baseline is established).
  • Adding good first issue labels to small starter bugs (mentioned in TODO.rnp-roadmap/16).

Closes #1189.
Closes #2317.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.36%. Comparing base (953d2e0) to head (eeecc7f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2418      +/-   ##
==========================================
- Coverage   85.36%   85.36%   -0.01%     
==========================================
  Files         126      126              
  Lines       22861    22866       +5     
==========================================
+ Hits        19516    19520       +4     
- Misses       3345     3346       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ronaldtse
ronaldtse requested review from antonsviridenko and ni4 July 31, 2026 16:20
Adds two pieces of project infrastructure that close long-standing gaps:

  * CONTRIBUTING.md (closes #1189 partially — CoC already existed at
    docs/code-of-conduct.adoc, but no CONTRIBUTING guide). Covers the
    practical bits contributors actually need: how to build/test
    locally, code style, commit conventions, PR checklist, the
    crypto-path test discipline, and how to add a new FFI function or
    CMake option.
  * .clang-tidy + .github/workflows/clang-tidy.yml (closes #2317).
    clang-tidy CI runs on push and PRs, on clang-18 + both backends.
    Configuration starts permissive (only a curated set of
    high-confidence checks; no WarningsAsErrors yet). The workflow
    captures findings to the GitHub Step Summary and uploads the full
    log as a 14-day artifact so reviewers can see the noise without
    the build gating on it.

The .clang-tidy check set covers: bugprone-* (assertion side effects,
dangling handles, use-after-move, swapped args, etc.), cert-* (the
sub-set that's not noisy on C++17), performance-* (move-const-arg,
unnecessary copies), modernize-* (loop-convert, override, nullptr),
and readability-* (cognitive complexity threshold 30, braces, etc.).
Modernize and performance checks will produce the most churn on first
run; that's expected — the follow-up work is to triage and fix
incrementally, then flip WarningsAsErrors on per category.

TODO.rnp-roadmap/16-code-of-conduct.md and /20-static-analysis.md
track the broader scope.
…ng log

- Switch from ubuntu:24.04 to ghcr.io/rnpgp/ci-rnp-debian-sid-amd64
  container, which has libbotan-3-dev available (Ubuntu 24.04's
  default repos don't ship it).
- Guard the Summarise step against missing clang-tidy.log so a
  failed Configure/Build doesn't cascade into a Summarise failure.

Also fix typo in CONTRIBUTING.md caught by `typos`: LICENSE.LESSer ->
LICENSE.LESSER.
@ronaldtse
ronaldtse force-pushed the coc-and-clang-tidy branch from a535ee7 to eeecc7f Compare August 9, 2026 23:06
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.

Investigate GitHub Action static analysis tool Implement Code of Conduct and community guidelines

1 participant