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 .beancount file extension support #332

Conversation

imWildCat
Copy link
Contributor

@imWildCat imWildCat commented May 28, 2024

.beancount is also widely used, including in the official repo.

Summary by CodeRabbit

  • New Features
    • Added support for the .beancount file extension, enhancing file compatibility for the beancount processor.

Copy link
Contributor

coderabbitai bot commented May 28, 2024

Walkthrough

The recent updates introduce support for the .beancount file extension in addition to the existing .bc and .bean extensions. This enhancement affects both the documentation and the zhang-cli project, ensuring the beancount processor in the zhang server and the OpendalDataSource implementation can handle .beancount files seamlessly.

Changes

File/Path Change Summary
docs/src/content/docs/installation/... Added support for the .beancount file extension in the beancount processor documentation.
zhang-cli/src/opendal.rs Modified the match expression in OpendalDataSource to include "beancount" as a supported data format.

In fields of code where changes bloom,
A new extension finds its room.
.beancount joins the data dance,
Enhancing flows with grace and chance.
The zhang server now extends,
Embracing files as new friends.
🎉🐇✨


Tip

Early Access Features
  • gpt-4o model for chat

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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to full the review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.

@imWildCat
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented May 28, 2024

Actions Performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Outside diff range and nitpick comments (1)
docs/src/content/docs/installation/2-beancount_launch.md (1)

Line range hint 14-14: Ensure the file ends with a single newline character.

+
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between e881964 and 40396ce.
Files selected for processing (2)
  • docs/src/content/docs/installation/2-beancount_launch.md (1 hunks)
  • zhang-cli/src/opendal.rs (1 hunks)
Additional Context Used
Markdownlint (1)
docs/src/content/docs/installation/2-beancount_launch.md (1)

14: null
Files should end with a single newline character

Additional comments not posted (2)
docs/src/content/docs/installation/2-beancount_launch.md (1)

7-7: The documentation clearly explains the support for the .beancount file extension. Good job on maintaining clarity and conciseness.

zhang-cli/src/opendal.rs (1)

189-189: The addition of "beancount" to the match expression correctly extends support for the new file extension. Ensure that all related components are updated to handle .beancount files appropriately.

Verification successful

The .beancount extension is consistently handled across multiple components in the codebase, including opendal.rs, parser.rs, lib.rs, and bindings/wasm/src/lib.rs. This confirms that the integration is thorough and correct.

  • zhang-cli/src/opendal.rs: Multiple references to .beancount handling.
  • extensions/beancount/src/parser.rs: Grammar definition for .beancount.
  • extensions/beancount/src/lib.rs: Various operations involving .beancount.
  • bindings/wasm/src/lib.rs: Handling of .beancount in WebAssembly bindings.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all components handle the `.beancount` extension correctly.

# Test: Search for the `.beancount` extension handling in the codebase. Expect: Consistent handling across all components.
rg --type rust $'beancount'

Length of output: 3238

@imWildCat
Copy link
Contributor Author

Hi @Kilerd, could you please take a look? Thanks!

@Kilerd
Copy link
Collaborator

Kilerd commented May 29, 2024

LGTM, I will merge it after the CI is pass

@Kilerd
Copy link
Collaborator

Kilerd commented May 29, 2024

Hey @imWildCat, do you mind to fix the error reported by clippy?

@imWildCat
Copy link
Contributor Author

error: doc list item missing indentation
Error:    --> zhang-ast/src/data.rs:174:9
    |
174 |     /// 2.1 return `unit * cost`, if cost is present
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
    = note: `-D clippy::doc-lazy-continuation` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::doc_lazy_continuation)]`
help: indent this line
    |
174 |     ///    2.1 return `unit * cost`, if cost is present
    |         +++

error: doc list item missing indentation
Error:    --> zhang-ast/src/data.rs:175:9
    |
175 |     /// 2.2 return `unit * single_price`, if single price is present
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
175 |     ///    2.2 return `unit * single_price`, if single price is present
    |         +++

error: doc list item missing indentation
Error:    --> zhang-ast/src/data.rs:176:9
    |
176 |     /// 2.3 return `total_price`, if total price is present
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
176 |     ///    2.3 return `total_price`, if total price is present
    |         +++

error: doc list item missing indentation
Error:    --> zhang-ast/src/data.rs:177:9
    |
177 |     /// 2.4 return `unit`, if both cost and price are not present.
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
177 |     ///    2.4 return `unit`, if both cost and price are not present.
    |         +++

error: could not compile `zhang-ast` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

seems not related to my change?

I'm not sure how to fix

@Kilerd
Copy link
Collaborator

Kilerd commented May 29, 2024

seems like clippy introduce some new rules, don't worry I will fix it later.

@Kilerd Kilerd merged commit 335ced7 into zhang-accounting:main May 29, 2024
22 of 23 checks passed
@imWildCat
Copy link
Contributor Author

thanks! you might want to enable squash merge btw

@imWildCat imWildCat deleted the bc/add-dot-beancount-file-extension-support branch May 29, 2024 16:33
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.

2 participants