Skip to content

ci(tooling): add lint for enum-level (not just variant-level) doc com… - #527

Merged
misrasamuelisiguzor-oss merged 2 commits into
WHEELBACK:mainfrom
mctituschristian:ci/enum-level-doc-comment-lint
Sep 3, 2026
Merged

ci(tooling): add lint for enum-level (not just variant-level) doc com…#527
misrasamuelisiguzor-oss merged 2 commits into
WHEELBACK:mainfrom
mctituschristian:ci/enum-level-doc-comment-lint

Conversation

@mctituschristian

Copy link
Copy Markdown
Contributor

…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

  • .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)

Description

Related Issue

Closes #[issue_id]

Checklist

…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)
@drips-wave

drips-wave Bot commented Sep 1, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@misrasamuelisiguzor-oss
misrasamuelisiguzor-oss merged commit 30105a2 into WHEELBACK:main Sep 3, 2026
5 of 20 checks passed
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.

Add a lint step verifying every new #[contracterror]/#[contracttype] enum has a doc comment on the enum itself, not just its variants

2 participants