dql: README - #2647
Conversation
Summary of ChangesHello @xushiwei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the documentation for the DOM Query Language (DQL) by completely overhauling its README file. The updated documentation aims to provide users with a clear and comprehensive understanding of DQL's capabilities, syntax, and usage across diverse tree-shaped data structures, thereby facilitating easier adoption and more effective utilization of the language within XGo projects. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a comprehensive README.md for the new DQL feature. The documentation is well-structured and covers the key aspects of DQL. I've found a few inconsistencies and potential errors in the code examples and error definitions, which I've detailed in my comments. Addressing these will improve the clarity and correctness of the documentation for developers using DQL.
| stmts := doc.shadowEntry.body.list.*@(self.class == "ExprStmt") | ||
|
|
||
| // Extract function names from call expressions | ||
| for fn in stmts.x@(self.class == "CallExpr").fun@(self.class == "Ident") { |
There was a problem hiding this comment.
In the XGo AST example, the field x in stmts.x appears to be a typo. The stmts variable holds a NodeSet of *ast.ExprStmt nodes. The relevant field on ast.ExprStmt that holds the expression is X (capitalized). Using the lowercase x will likely fail. Please correct this to X.
| for fn in stmts.x@(self.class == "CallExpr").fun@(self.class == "Ident") { | |
| for fn in stmts.X@(self.class == "CallExpr").fun@(self.class == "Ident") { |
| } | ||
|
|
||
| // Collect all Go source file names | ||
| names := [f.$name for f in root.**.file@match("*.go", $name)] |
There was a problem hiding this comment.
The syntax in this File System example appears to be incorrect. The match function is a method on the fs.NodeSet and should be called with . notation, not with @. It also accepts only one argument (the pattern). The second argument $name is not valid. To fix this, match should be called as a method on the NodeSet.
| names := [f.$name for f in root.**.file@match("*.go", $name)] | |
| names := [f.$name for f in root.**.file.match("*.go")] |
| var ( | ||
| ErrNotFound = errors.New("node not found") | ||
| ErrMultipleEntities = errors.New("multiple entities found, expected single") | ||
| ) |
There was a problem hiding this comment.
The standard errors documented here are inconsistent with their definitions in dql/dql.go. The variable name ErrMultipleEntities should be ErrMultiEntities, and the error messages for both ErrNotFound and ErrMultiEntities are different in the source code. Please update the documentation to reflect the actual implementation to avoid confusion.
| var ( | |
| ErrNotFound = errors.New("node not found") | |
| ErrMultipleEntities = errors.New("multiple entities found, expected single") | |
| ) | |
| var ( | |
| ErrNotFound = errors.New("entity not found") | |
| ErrMultiEntities = errors.New("too many entities found") | |
| ) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2647 +/- ##
=======================================
Coverage 94.10% 94.10%
=======================================
Files 32 32
Lines 9964 9964
=======================================
Hits 9377 9377
Misses 419 419
Partials 168 168 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.