Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: update style guide #10424

Merged
merged 2 commits into from May 16, 2024
Merged

doc: update style guide #10424

merged 2 commits into from May 16, 2024

Conversation

mds1
Copy link
Contributor

@mds1 mds1 commented May 6, 2024

No description provided.

@mds1 mds1 requested a review from a team as a code owner May 6, 2024 20:07
@mds1 mds1 requested a review from Inphi May 6, 2024 20:07
Copy link
Contributor

coderabbitai bot commented May 6, 2024

Walkthrough

Walkthrough

The recent update enriches the contracts-bedrock package with comprehensive style and operational guidelines for smart contracts. It emphasizes precise source code management, especially focusing on event emissions for state changes, and extends testing principles to ensure the solidity and reliability of the contracts.

Changes

File Path Change Summary
.../contracts-bedrock/STYLE_GUIDE.md Added guidelines on style, versioning, dependencies, source code event emissions, and testing principles for smart contracts.

Recent Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 97d83cb and 7c08a13.
Files selected for processing (1)
  • packages/contracts-bedrock/STYLE_GUIDE.md (2 hunks)
Additional Context Used
LanguageTool (16)
packages/contracts-bedrock/STYLE_GUIDE.md (16)

Near line 21: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ests](#tests) - [Expect Revert with Low Level Calls](#expect-revert-with-low-level-ca...


Near line 49: Loose punctuation mark.
Context: ...lowing custom tags: - @custom:proxied: Add to a contract whenever it's meant t...


Near line 50: Loose punctuation mark.
Context: ... behind a proxy. - @custom:upgradeable: Add to a contract whenever it's meant t...


Near line 51: Loose punctuation mark.
Context: ...upgradeable contract. - @custom:semver: Add to version variable which indicat...


Near line 52: Loose punctuation mark.
Context: ...the contracts semver. - @custom:legacy: Add to an event or function when it onl...


Near line 53: Loose punctuation mark.
Context: ...cy support. - @custom:network-specific: Add to state variables which vary betwe...


Near line 67: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...d be prefixed with an underscore. #### Function Return Arguments - Arguments returned ...


Near line 79: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...able variables Immutable variables: - should be in SCREAMING_SNAKE_CASE - should b...


Near line 80: Do not use the modal verb ‘should’ after the verb ‘be’. Did you mean “should”?
Context: ...d be in SCREAMING_SNAKE_CASE - should be internal - should have a hand written getter function Th...


Near line 81: This word is normally spelled as one.
Context: ... - should be internal - should have a hand written getter function This approach clearly ...


Near line 123: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...break the existing interface. - major releases are to be used for changes that break t...


Near line 127: Consider shortening or rephrasing this to strengthen your wording.
Context: ...rule for theWETH` contract to avoid making changes to a well-known, simple, and recognizable ...


Near line 153: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...t-names.ts ``` #### Expect Revert with Low Level Calls There is a non-intuitive behavio...


Near line 162: Possible missing comma found.
Context: ...ontract`s are used to organize the test suite similar to how mocha uses describe. - E...


Near line 189: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...n. - TargetContract_Function_TestFail for contracts containing sad path tests for...


Near line 192: The abbreviation “i.e.” (= that is) requires two periods.
Context: ...together into a single test contract, ie. TargetContract_Getters_Test. ## With...


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Out of diff range and nitpick comments (7)
packages/contracts-bedrock/STYLE_GUIDE.md (7)

21-21: Consider using a hyphen in "Low Level Calls" to form the compound adjective "Low-Level Calls".


Line range hint 51-51: Add an apostrophe to indicate possession in "contracts semver" to "contract's semver".

- @custom:semver: Add to `version` variable which indicate the contracts semver.
+ @custom:semver: Add to `version` variable which indicate the contract's semver.

Line range hint 79-81: Clarify the use of "should" in the description of immutable variables. Consider using more assertive language to enhance the directive nature of the guidelines.

- should be in `SCREAMING_SNAKE_CASE`
- should be `internal`
- should have a hand written getter function
+ must be in `SCREAMING_SNAKE_CASE`
+ must be `internal`
+ must have a hand-written getter function

Line range hint 113-113: Consider adding a comma after "contract" for better readability.

- All (non-library and non-abstract) contracts MUST extend the `Semver` base contract which
+ All (non-library and non-abstract) contracts MUST extend the `Semver` base contract, which

Line range hint 163-163: Consider adding a comma after "describe" for better readability.

- Solidity `contract`s are used to organize the test suite similar to how mocha uses describe.
+ Solidity `contract`s are used to organize the test suite similar to how mocha uses describe,

Line range hint 193-193: Correct the abbreviation "ie." to "i.e." for proper formatting.

- ie. `TargetContract_Getters_Test`.
+ i.e. `TargetContract_Getters_Test`.

Line range hint 150-150: Specify a language for the fenced code block to enable proper syntax highlighting.

- ```
+ ```typescript

Copy link

codecov bot commented May 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.22%. Comparing base (29c7b44) to head (7c08a13).
Report is 23 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #10424       +/-   ##
============================================
- Coverage    42.30%   29.22%   -13.08%     
============================================
  Files           73       31       -42     
  Lines         4848     2898     -1950     
  Branches       766      614      -152     
============================================
- Hits          2051      847     -1204     
+ Misses        2686     1976      -710     
+ Partials       111       75       -36     
Flag Coverage Δ
cannon-go-tests ?
chain-mon-tests 27.14% <ø> (ø)
common-ts-tests ?
contracts-ts-tests 12.25% <ø> (ø)
core-utils-tests ?
sdk-tests 40.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 42 files with indirect coverage changes

Co-authored-by: Maurelian <john@oplabs.co>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Out of diff range and nitpick comments (3)
packages/contracts-bedrock/STYLE_GUIDE.md (3)

Line range hint 153-153: Hyphenate "Low-Level" in the section title.

Consider changing "Low Level Calls" to "Low-Level Calls" to form a correct compound adjective in the section title:

- [Expect Revert with Low-Level Calls](#expect-revert-with-low-level-calls)

Line range hint 192-192: Correct the abbreviation for "that is".

Change "ie." to "i.e.," to correctly punctuate the abbreviation for "that is":

- `TargetContract_Getters_Test` for contracts containing grouped getter functions, i.e., `TargetContract_Getters_Test`.

Line range hint 79-81: Clarify the guidance on immutable variables.

The current guidance on immutable variables could be clearer. Consider rephrasing to:

Immutable variables should:
- Be in `SCREAMING_SNAKE_CASE`
- Be `internal`
- Have a manually written getter function

This change enhances clarity and readability.

packages/contracts-bedrock/STYLE_GUIDE.md Show resolved Hide resolved
Copy link

semgrep-app bot commented May 8, 2024

Semgrep found 1 writable-filesystem-service finding:

  • ops-bedrock/docker-compose.yml

Service 'op_stack_go_builder' is running with a writable root filesystem. This may allow malicious applications to download and run additional payloads, or modify container files. If an application inside a container has to save something temporarily consider using a tmpfs. Add 'read_only: true' to this service to prevent this.

Ignore this finding from writable-filesystem-service.

Semgrep found 1 no-new-privileges finding:

  • ops-bedrock/docker-compose.yml

Service 'op_stack_go_builder' allows for privilege escalation via setuid or setgid binaries. Add 'no-new-privileges:true' in 'security_opt' to prevent this.

Ignore this finding from no-new-privileges.

@mds1 mds1 enabled auto-merge May 9, 2024 03:30
@mds1 mds1 added this pull request to the merge queue May 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2024
@tynes tynes added this pull request to the merge queue May 16, 2024
Merged via the queue into develop with commit 3911609 May 16, 2024
71 of 72 checks passed
@tynes tynes deleted the doc/contracts-style-guide branch May 16, 2024 09:45
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.

None yet

4 participants