Skip to content

improve documentation section#13274

Open
ShahakShama wants to merge 1 commit intoshahak/style-guide-remove-track-callerfrom
shahak/style-guide-documentation
Open

improve documentation section#13274
ShahakShama wants to merge 1 commit intoshahak/style-guide-remove-track-callerfrom
shahak/style-guide-documentation

Conversation

@ShahakShama
Copy link
Copy Markdown
Collaborator

@ShahakShama ShahakShama commented Mar 15, 2026

Note

Low Risk
Documentation-only edits to the coding conventions; no runtime or behavioral code changes.

Overview
Updates style.md's documentation guidance by renaming the section to ## Documentation and clarifying the split between API docs (///) vs implementation comments (//).

Adds explicit rules for abbreviations vs acronyms in identifiers/docs, and expands the "trivial comments" guidance with stronger rationale plus new examples showing restatement vs "why" comments and when a short block-summary comment is acceptable (with a suggestion to extract helpers instead).

Written by Cursor Bugbot for commit d796251. This will update automatically on new commits. Configure here.

@ShahakShama ShahakShama requested a review from Stavbe March 15, 2026 15:26
@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

ShahakShama commented Mar 15, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@ShahakShama ShahakShama force-pushed the shahak/style-guide-remove-track-caller branch from 3c533d0 to 3919551 Compare March 16, 2026 07:38
@ShahakShama ShahakShama force-pushed the shahak/style-guide-documentation branch from e4c1846 to 27d38ff Compare March 16, 2026 07:38
Copy link
Copy Markdown
Contributor

@Stavbe Stavbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this --- do something or it is just an AI footprint

@Stavbe made 10 comments.
Reviewable status: 0 of 1 files reviewed, 9 unresolved discussions (waiting on ShahakShama).


style.md line 368 at r2 (raw file):

## Documentation

Make sure every struct, enum, member, function, method and enum variant that's part of the API is documented --- Unless there's nothing to add that the name didn't cover

,

Code quote:

---

style.md line 370 at r2 (raw file):

Make sure every struct, enum, member, function, method and enum variant that's part of the API is documented --- Unless there's nothing to add that the name didn't cover

Use `///` to document the API --- for the user.

remove

Code quote:

--- for the user.

style.md line 372 at r2 (raw file):

Use `///` to document the API --- for the user.

Use `//` to explain how the code works --- for someone reading the internal implementation.

removeb

Code quote:

---

style.md line 376 at r2 (raw file):

Don't use `/* */` - style comments.

If you want to use an abbreviation (e.g. `tx` for `transaction`) or acronym (e.g. `ABI` for `Application Binary Interface`), introduce it in the documentation of the struct/enum the abbreviation/acronym shortens.

Do we want people to write tx = transaction in the enum definition ? It is weird... maybe -make sure the fielde documented with the "full" word.


style.md line 388 at r2 (raw file):

Take extra care when using AI-generated code, which tends to include a lot of trivial comment-bloat.

**Rationale**: clear code is self-documenting; repeating it wastes the reader's time and adds maintenance burden, as the comment can drift out of sync with the code it describes.

I think we want to avoid this, say, because we want to encourage people to do.

Code quote:

**Rationale**: clear code is self-documenting; repeating it wastes the reader's time and adds maintenance burden, as the comment can drift out of sync with the code it describes.

style.md line 397 at r2 (raw file):

// BAD - Restates the function signature.
/// Returns the user's name.
fn user_name(&self) -> &str { ... }

I think this bsd needs to be removed because we encourage documenting also "obvious" functions.

Code quote:

// BAD - Restates the function signature.
/// Returns the user's name.
fn user_name(&self) -> &str { ... }

style.md line 405 at r2 (raw file):

However, a comment that gives a title to a paragraph of code is useful --- it tells the reader what the block achieves so they can skim or skip it.

remove

Code quote:

---

style.md line 423 at r2 (raw file):

When you find yourself adding such a title comment, consider extracting the paragraph into a helper function where it makes sense --- the function name then serves as the documentation.

remove

Code quote:

--- the function name then serves as the documentation.

@ShahakShama ShahakShama force-pushed the shahak/style-guide-remove-track-caller branch from 3919551 to 4f1503e Compare March 26, 2026 07:20
@ShahakShama ShahakShama force-pushed the shahak/style-guide-documentation branch from 27d38ff to 2e9fc25 Compare March 26, 2026 07:20
@ShahakShama ShahakShama force-pushed the shahak/style-guide-remove-track-caller branch from 4f1503e to dcc3953 Compare March 26, 2026 07:27
@ShahakShama ShahakShama force-pushed the shahak/style-guide-documentation branch from 2e9fc25 to d8464ca Compare March 26, 2026 07:27
Copy link
Copy Markdown
Collaborator Author

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShahakShama made 7 comments.
Reviewable status: 0 of 1 files reviewed, 8 unresolved discussions (waiting on Stavbe).


style.md line 370 at r2 (raw file):

Previously, Stavbe wrote…

remove

I like the for the user section. Changed to parentheses


style.md line 372 at r2 (raw file):

Previously, Stavbe wrote…

removeb

Done.


style.md line 376 at r2 (raw file):

Previously, Stavbe wrote…

Do we want people to write tx = transaction in the enum definition ? It is weird... maybe -make sure the fielde documented with the "full" word.

I mainly thought of the acronym section when writing this. how's this now?


style.md line 388 at r2 (raw file):

Previously, Stavbe wrote…

I think we want to avoid this, say, because we want to encourage people to do.

I disagree. Lior also said that this rationale is true. If you want we can bring this to discussion


style.md line 397 at r2 (raw file):

Previously, Stavbe wrote…

I think this bsd needs to be removed because we encourage documenting also "obvious" functions.

I disagree. I also wrote this at the top of the documentation section (Unless there's nothing to add that the name didn't cover)


style.md line 405 at r2 (raw file):

Previously, Stavbe wrote…

remove

I do want a non-comma separator. How's this?


style.md line 423 at r2 (raw file):

Previously, Stavbe wrote…

remove

Done.

Copy link
Copy Markdown
Collaborator Author

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShahakShama made 1 comment.
Reviewable status: 0 of 1 files reviewed, 8 unresolved discussions (waiting on Stavbe).


style.md line 368 at r2 (raw file):

Previously, Stavbe wrote…

,

Done.

@ShahakShama ShahakShama force-pushed the shahak/style-guide-documentation branch from d8464ca to 9424c4e Compare March 26, 2026 07:44
@ShahakShama ShahakShama force-pushed the shahak/style-guide-documentation branch from 9424c4e to d796251 Compare March 26, 2026 09:24
Copy link
Copy Markdown
Contributor

@Stavbe Stavbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stavbe made 1 comment and resolved 6 discussions.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on ShahakShama).


style.md line 379 at r4 (raw file):

### Abbreviations and Acronyms
Abbreviations (e.g. `tx` for `transaction`) are allowed only in variables, function arguments and function names. Prefer to avoid them in function names if possible.

This is confusing. It is always possible. Let's choose yes or no- I vote for yes.

Code quote:

and function names. Prefer to avoid them in function names if possible.

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.

3 participants