Skip to content

Add Rust coding rules catalogue aligned with the SCRC MISRA C++ cross-reference (draft) - #3262

Draft
dcalavrezo-qorix wants to merge 2 commits into
mainfrom
docs/rust-coding-rules
Draft

dcalavrezo-qorix wants to merge 2 commits into
mainfrom
docs/rust-coding-rules

Conversation

@dcalavrezo-qorix

@dcalavrezo-qorix dcalavrezo-qorix commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Improvement

Description

Adds a draft rulebook of 43 Rust coding rules under docs/contribute/development/rust/coding_rules/, proposing S-CORE rule text for the MISRA C++:2023 guidelines that the Safety-Critical Rust Consortium's own cross-reference (safety-critical-rust-coding-guidelines PR #1226, pinned at commit 9e81abd4) marks as applicable to safe or unsafe Rust.

The new section contains:

  • Overview with attribution, the relation to the existing Rust coding guidelines, the adoption rules and the Required/Advisory level semantics.
  • Rule catalogue, generated from _assets/rules.json. Each rule has a stable SCR-RUST-NNN identifier, its MISRA C++ source IDs with the SCRC verdict, the obligation, the enforcement candidates (rustc, Clippy, CodeQL, review) and the known coverage limits.
  • Applicability register covering all 179 MISRA C++:2023 guidelines with the SCRC verdict, related MISRA C:2025 guideline, SCRC guideline link, the MISRust class as secondary traceability, and the S-CORE disposition. A review queue lists the 9 applicable guidelines without a rule yet and the 5 guidelines retained beyond the SCRC verdict.
  • Verification and deviations describing the per-rule coverage record, checker validation, deviation records and a staged rollout.

Each page is a document need realizing wp__sw_development_plan, matching the existing C++ MISRA mapping page. tools/render_rust_coding_rules.py regenerates the catalogue, the mapping table and the review queue, and validates the register against the pinned SCRC verdicts (--check).

Sources and positioning

  • Primary: SCRC MISRA C++:2023 cross-reference (54 safe, 38 unsafe, 87 not applicable). Still an open PR under weekly subcommittee review; the pinned revision is recorded in the source manifest and must be re-aligned when it changes.
  • Secondary: MISRust (Molz et al., RWTH Aachen, arXiv:2605.23490v2). Where it disagrees with SCRC, SCRC is followed. The SCRC's own differences analysis is linked.
  • The catalogue does not change the CERT-style stance in doc__rust_coding_guidelines. It is a gap review against the score_rust_policies lint profile, binds a component only after adoption through its Software Development Plan, and the rule text is offered as candidate input to the SCRC guidelines, which currently cover 3 of the 92 applicable MISRA C++ guidelines. Everything is draft; no CI check is enabled.

Licensing

  • SCRC cross-reference: CC-BY-4.0 (documentation per repository COPYRIGHT). Verdicts, MISRA C references and guideline links reproduced unchanged; rationale text not copied. Attributed in the pages, source manifest and NOTICE.
  • MISRust paper and dataset: CC-BY-4.0, attributed likewise; classifications reproduced unchanged.
  • MISRA C++:2023 and MISRA C:2025 Addendum 6 are cited by guideline number, kind and category only. No MISRA text is reproduced or redistributed.
  • Committers: please confirm whether the CC-BY-4.0 content needs an Eclipse IP review entry before merge.

Verification

  • bazel run //:docs_check: build succeeded, 0 warnings, all needs valid
  • bazel run //:copyright.check: 0 files without header
  • bazel test //:format.check: 3/3 passed
  • python3 tools/render_rust_coding_rules.py --check: generated files current

Related ticket

No improvement ticket exists yet; to be created and linked before the PR leaves draft.

Add a draft rulebook of 43 Rust coding rules under
docs/contribute/development/rust/coding_rules, derived from the 69
MISRA C++:2023 guidelines that the MISRust study (Molz et al.,
arXiv:2605.23490v2) retains as relevant for Rust, plus three S-CORE
supplements for dependencies, foreign interfaces and verification
governance.

The section contains an overview with adoption rules, the generated
rule catalogue, an applicability register covering all 179 MISRA C++
guidelines with the unchanged MISRust classification and the S-CORE
disposition, and a page on per-rule verification evidence and
deviation records. Each page is a document need realizing the
Software Development Plan, matching the existing C++ MISRA mapping
page.

Rule text and metadata live in _assets/rules.json; the catalogue and
the compact mapping table are generated by
tools/render_rust_coding_rules.py, which also validates the mapping.

The catalogue is positioned as a rule-by-rule gap review that
supplements the lint profile in score_rust_policies. It does not
change the CERT-style stance of the Rust coding guidelines page and
binds a component only after adoption through its Software
Development Plan. No CI check is enabled.

MISRust paper and dataset are CC-BY-4.0 and are attributed in the
pages, the source manifest and NOTICE. MISRA guidelines are cited by
number, kind and category only; no MISRA text is reproduced.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-3262: https://eclipse-score.github.io/score/pr-3262/

@RolandJentschETAS

Copy link
Copy Markdown
Contributor

Only as question: Is this on top of rustc and clippy rules ? See https://eclipse-score.github.io/score/main/contribute/development/rust/coding_guidelines.html

Make the Safety-Critical Rust Consortium's MISRA C++:2023 cross-reference
(safety-critical-rust-coding-guidelines PR #1226, commit 9e81abd4) the
primary applicability reference for the draft rulebook. MISRust remains
a secondary reference; its C1-C6 class is kept per guideline for
traceability, and where the two disagree the SCRC verdict is followed.

The applicability register gains the SCRC verdict (safe, unsafe, not
applicable), the related MISRA C:2025 guideline and the SCRC guideline
link per row. Dispositions are derived from the SCRC verdict: 83
applicable guidelines map to S-CORE rules, 9 are queued for rule
assignment, 82 not-applicable guidelines are excluded, and 5 are
retained beyond the SCRC verdict with a stated reason. Both open groups
are rendered as a review queue on the applicability page.

Rule source IDs are adjusted accordingly: 19 guidelines SCRC marks
applicable are attached to fitting rules, 14 guidelines SCRC marks not
applicable are detached, and SCR-RUST-010 becomes a supplement without a
MISRA C++ source. Rule text is unchanged. The render script validates the
register against the pinned SCRC counts and derives each disposition from
the verdict and rule links.

Attribution, source manifest and NOTICE name the SCRC cross-reference
(CC-BY-4.0 documentation, unmerged at time of use) alongside MISRust.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
@dcalavrezo-qorix dcalavrezo-qorix changed the title Add MISRA-derived Rust coding rules catalogue as draft Add Rust coding rules catalogue aligned with the SCRC MISRA C++ cross-reference (draft) Sep 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog
Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants