chore: code-style fixes per STYLEGUIDE#392
Conversation
- STYLEGUIDE: codify doc-comments as the API source of truth — Aborts lists every error (including propagated), preconditions map to their error, and Parameters/Returns are included only where they add detail beyond the summary; add a pin-exact exception for tolerance/approximation assertions (e.g. fixed-point log/sqrt vs an off-chain reference). - Document struct fields on the access hot-potato structs (delayed/two_step Borrow, two_step RequestBorrow) and fixed_point Components. - Drop the test_ prefix from access_control_tests functions (descriptive names per STYLEGUIDE Testing). Verified with sui move test --lint --warnings-are-errors and build --doc (testnet): access 137, math/core 753, math/fixed_point 426 — all green.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #392 +/- ##
==========================================
- Coverage 78.90% 78.88% -0.02%
==========================================
Files 23 23
Lines 1782 1781 -1
Branches 640 642 +2
==========================================
- Hits 1406 1405 -1
Misses 341 341
Partials 35 35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughExpands ChangesStyle Guide, Documentation, and Test Updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Drop the hardcoded primitive list (access control / math / rate limiting) from the blockquote — it drifts as the library grows. Reframe around discovery.
Bring main (incl. #388 em-dash convention, #390/#391/#394) into the branch, main-authoritative on logistics. Keep this branch's additions: doc-comment standard + pin-exact tolerance exception in STYLEGUIDE, struct-field docs, test_ rename, llms.txt discovery wording - all em-dash-free per the merged convention (the lone intentional em-dash is the rule's own example).
- STYLEGUIDE: Aborts section lists native aborts too (overflow, div-by-zero); precondition example follows the actual '- `Error` if ...' convention - math/core: name the concrete error in mul_div/inv_mod/mul_mod wrappers (EDivideByZero / EZeroModulus) instead of generic 'Aborts if ...' - macros: mul_div Aborts reformatted to convention; mul_shr Aborts section removed (it cannot abort - overflow is returned as a flag) - decimal_scaling: normalize abort bullets to '- `Error` if ...'
- New public-facing component (package or public capability) must ship a runnable example in the same PR - examples are the integration-facing source of truth for AI agents and downstream integrators - Restore the 'register new package in the CI matrix' rule that was dropped during an earlier main sync
Library-wide STYLEGUIDE review (math/core + math/fixed_point): - fixed_point: name the concrete error in every #### Aborts bullet across both type families (EOverflow / EUnderflow / EDivideByZero / EInvalidShiftSize / ENegativeValue / EIntegerOverflow / ECannotBeConverted*), replacing generic 'Aborts if ...'; fixes the div/mod vs div_trunc/div_away naming inconsistency - math/core: align clz summary across widths; unify is_power_of_ten doc to the '10^0 to 10^N' range form for all six widths - macros: name the native shift-overflow cause in checked_shl/checked_shr; fix smart quotes and a missing floor bracket in doc-comments
General code-style cleanup against
STYLEGUIDE.md. Does not close any issue.Changes
sui move build --doc, consumed by AI-integrator tooling):#### Abortslists every error a function can raise, including errors propagated from internal calls;#### Parameters/#### Returnsonly where they add detail beyond the one-line summary (a trivial getter needs neither);assert!(diff < epsilon)) stay bound-based — do not convert toassert_eq!.access(delayed/two_stepBorrow,two_stepRequestBorrow) andfixed_pointComponents.test_prefix fromaccess_control_testsfunctions (descriptive names per STYLEGUIDE Testing), matching the sibling test modules.Verification
sui move test --build-env testnet --lint --warnings-are-errorsandsui move build --doc --build-env testnet, all green:contracts/access— 137 testsmath/core— 753 testsmath/fixed_point— 426 testsOut of scope (follow-up)
access_control_testsstill carries#[allow(lint(...))](4) andabort 999sentinels (43); removing them requires restructuring the expected-failure tests (and resolvingshare_owned) and is left to a separate focused PR.🤖 Generated with Claude Code
Summary by CodeRabbit
#### Parameters,#### Returns, and detailed#### Abortslistings.