ci(tooling): add lint for enum-level (not just variant-level) doc com… - #527
Merged
misrasamuelisiguzor-oss merged 2 commits intoSep 3, 2026
Conversation
…ments Closes WHEELBACK#446. ## Problem Issue WHEELBACK#69 added rustdoc comments to every individual error variant but nothing enforced — or even consistently required — a doc comment on the enum declaration itself. A reader landing on an enum with 14 variants and no framing comment has no high-level context before diving into the individual descriptions. ## Solution scripts/check-enum-doc-comments.sh — a new grep-based lint script that scans every non-test .rs file under contracts/ and crates/ for pub enums preceded by #[contracterror] or #[contracttype], and verifies that at least one '///' doc-comment line appears in the contiguous attribute block immediately before the enum declaration. ## Integration - .pre-commit-config.yaml: new 'check-enum-doc-comments' hook runs after the existing check-enum-ordering hook on every commit. - justfile / Makefile: 'precommit' target updated to call the script so 'just precommit' / 'make precommit' mirrors CI exactly. ## Doc comments added All #[contracterror]/#[contracttype] enums that were missing an enum-level /// comment now have one: crates/multisig — TreasuryError, SettlementHoldReason, SettlementStatus, DisputeStatus, RotationStatus, DataKey crates/compliance-errors — ComplianceError crates/invoice-errors — InvoiceError contracts/compliance — DataKey (moved comment before attribute) contracts/invoice — InvoiceStatus, MaybeAddress, MaybeBytes, DataKey contracts/settlement-workflow — DataKey (duplicate variant also fixed) ## Verification bash scripts/check-enum-doc-comments.sh → exit 0 (all pass) [remove a doc comment] && bash scripts/... → exit 1 (caught)
|
@mctituschristian Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
…ments
Closes #446.
Problem
Issue #69 added rustdoc comments to every individual error variant but nothing enforced — or even consistently required — a doc comment on the enum declaration itself. A reader landing on an enum with 14 variants and no framing comment has no high-level context before diving into the individual descriptions.
Solution
scripts/check-enum-doc-comments.sh — a new grep-based lint script that scans every non-test .rs file under contracts/ and crates/ for pub enums preceded by #[contracterror] or #[contracttype], and verifies that at least one '///' doc-comment line appears in the contiguous attribute block immediately before the enum declaration.
Integration
Doc comments added
All #[contracterror]/#[contracttype] enums that were missing an enum-level /// comment now have one:
crates/multisig — TreasuryError, SettlementHoldReason,
SettlementStatus, DisputeStatus,
RotationStatus, DataKey
crates/compliance-errors — ComplianceError
crates/invoice-errors — InvoiceError
contracts/compliance — DataKey (moved comment before attribute)
contracts/invoice — InvoiceStatus, MaybeAddress, MaybeBytes, DataKey
contracts/settlement-workflow — DataKey (duplicate variant also fixed)
Verification
bash scripts/check-enum-doc-comments.sh → exit 0 (all pass)
[remove a doc comment] && bash scripts/... → exit 1 (caught)
Description
Related Issue
Closes #[issue_id]
Checklist
just checkpassing locallyCloses Add a lint step verifying every new #[contracterror]/#[contracttype] enum has a doc comment on the enum itself, not just its variants #446