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

Add missing odra::prelude path in generated code #436

Merged
merged 2 commits into from
May 16, 2024

Conversation

kpob
Copy link
Contributor

@kpob kpob commented May 15, 2024

Summary by CodeRabbit

  • Refactor

    • Unified string creation across various modules using odra::prelude::string::String::from for better consistency and code readability.
  • Bug Fixes

    • Improved the handling of function names within certain function calls to ensure proper string extraction and expression construction.

These changes enhance code maintainability and readability without impacting end-user functionality.

@kpob kpob linked an issue May 15, 2024 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented May 15, 2024

Walkthrough

The recent updates in the odra-macros library involve refining how strings are constructed by explicitly using odra::prelude::string::String::from. This ensures consistent string handling across various modules. Additionally, there are changes in collection types and expression constructions to enhance code clarity and maintainability.

Changes

Files Change Summary
odra-macros/src/ast/contract_ref_item.rs
odra-macros/src/ast/external_contract_item.rs
odra-macros/src/ast/host_ref_item.rs
odra-macros/src/ast/test_parts.rs
Replaced String::from("...") with odra::prelude::string::String::from("...") for string creation.
odra-macros/src/ast/entrypoints_item.rs Added use syn::punctuated::Punctuated;, changed collection types and expression constructions.
odra-macros/src/ast/ref_utils.rs Modified function calls to use a utility function for extracting function names as strings.

In code we trust, where strings now align,
With odra::prelude, our functions shine.
Collections punctuated, expressions clear,
A better odra-macros, we all cheer.
🐇✨


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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between ab4a03f and ff29b1a.
Files selected for processing (6)
  • odra-macros/src/ast/contract_ref_item.rs (12 hunks)
  • odra-macros/src/ast/entrypoints_item.rs (7 hunks)
  • odra-macros/src/ast/external_contract_item.rs (2 hunks)
  • odra-macros/src/ast/host_ref_item.rs (12 hunks)
  • odra-macros/src/ast/ref_utils.rs (2 hunks)
  • odra-macros/src/ast/test_parts.rs (7 hunks)
Files not reviewed due to errors (3)
  • odra-macros/src/ast/external_contract_item.rs (no review received)
  • odra-macros/src/ast/entrypoints_item.rs (no review received)
  • odra-macros/src/ast/test_parts.rs (no review received)
Files skipped from review due to trivial changes (1)
  • odra-macros/src/ast/contract_ref_item.rs
Additional comments not posted (14)
odra-macros/src/ast/ref_utils.rs (2)

73-74: Use odra::prelude::string::String::from for string creation.

The change to use odra::prelude::string::String::from ensures consistency in string creation across the codebase.


83-85: Use odra::prelude::string::String::from for string creation.

The change to use odra::prelude::string::String::from ensures consistency in string creation across the codebase.

odra-macros/src/ast/host_ref_item.rs (12)

427-427: Update to use odra::prelude::string::String::from("init") looks good.


448-448: Update to use odra::prelude::string::String::from("total_supply") looks good.


467-467: Update to use odra::prelude::string::String::from("pay_to_mint") looks good.


492-492: Update to use odra::prelude::string::String::from("approve") looks good.


514-514: Update to use odra::prelude::string::String::from("airdrop") looks good.


598-598: Update to use odra::prelude::string::String::from("total_supply") looks good.


618-618: Update to use odra::prelude::string::String::from("pay_to_mint") looks good.


719-719: Update to use odra::prelude::string::String::from("total_supply") looks good.


739-739: Update to use odra::prelude::string::String::from("get_owner") looks good.


760-760: Update to use odra::prelude::string::String::from("set_owner") looks good.


782-782: Update to use odra::prelude::string::String::from("name") looks good.


803-803: Update to use odra::prelude::string::String::from("symbol") looks good.

@kpob kpob merged commit c79b2af into release/1.0.0 May 16, 2024
4 checks passed
@kpob kpob deleted the fix/simple-module-requires-prelude-load branch May 24, 2024 09:12
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.

Simple module requires prelude load.
2 participants