Add Rust coding rules catalogue aligned with the SCRC MISRA C++ cross-reference (draft) - #3262
Draft
dcalavrezo-qorix wants to merge 2 commits into
Draft
dcalavrezo-qorix wants to merge 2 commits into
dcalavrezo-qorix wants to merge 2 commits into
Conversation
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>
Contributor
|
Documentation preview for this pull request is available at: |
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>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 commit9e81abd4) marks as applicable to safe or unsafe Rust.The new section contains:
_assets/rules.json. Each rule has a stableSCR-RUST-NNNidentifier, its MISRA C++ source IDs with the SCRC verdict, the obligation, the enforcement candidates (rustc, Clippy, CodeQL, review) and the known coverage limits.Each page is a
documentneed realizingwp__sw_development_plan, matching the existing C++ MISRA mapping page.tools/render_rust_coding_rules.pyregenerates the catalogue, the mapping table and the review queue, and validates the register against the pinned SCRC verdicts (--check).Sources and positioning
doc__rust_coding_guidelines. It is a gap review against thescore_rust_policieslint 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 isdraft; no CI check is enabled.Licensing
NOTICE.Verification
bazel run //:docs_check: build succeeded, 0 warnings, all needs validbazel run //:copyright.check: 0 files without headerbazel test //:format.check: 3/3 passedpython3 tools/render_rust_coding_rules.py --check: generated files currentRelated ticket
No improvement ticket exists yet; to be created and linked before the PR leaves draft.