-
Notifications
You must be signed in to change notification settings - Fork 708
Coding agents guidelines #2298
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
Open
yoavcloud
wants to merge
3
commits into
apache:main
Choose a base branch
from
yoavcloud:coding_agents_guidelines
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+35
−0
Open
Coding agents guidelines #2298
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Extensible SQL Lexer and Parser for Rust Agents Guidelines | ||
|
|
||
| ## General Agent Workflow | ||
| 1. You will write unit tests to ensure your code change is working as expected. | ||
| 2. You will run the commands in the Pre Commit Checks section below to ensure your change is ready for a pull request. | ||
| 3. When instructed to open a PR, you will follow the instructions in the Pull Request Guidelines section below. | ||
|
|
||
| ## General Coding Guidelines | ||
| 1. Refrain from adding conditions on specific dialects, such as `dialect_is!(...)` or `dialect_of!(... | ...)`. Instead, define a new function in the `Dialect` trait that describes the condition, so that dialects can turn this condition on more easily. | ||
| 2. Make targeted code changes and refrain from refactoring, unless it's absolutely required. | ||
|
|
||
| ## Unit Tests Guidelines | ||
| - When testing a multi-line SQL statement, use a raw string literal, i.e. `r#"..."#` to preserve formatting. | ||
| - You can use the following template for simple unit tests: | ||
| ```rust | ||
| <dialect>().parse_sql_statements(r#"..."#).unwrap(); | ||
| ``` | ||
| For example: `snowflake().parse_sql_statements(r#"SELECT * FROM my_table"#).unwrap();` | ||
| - New unit tests should be added to the `tests` module in the corresponding dialect file (e.g., `tests/sqlparser_redshift.rs` for Redshift), and should be placed at the end of the file. | ||
| - If the new functionality is gated using a dialect function, and the SQL is likely relevant in most dialects, tests should be placed under `tests/sqlparser_common.rs`. | ||
|
|
||
| ## Analyzing Parsing Issues | ||
| You can try to simplify the SQL statement to identify the root cause of the parsing issue. This may involve removing certain clauses or components of the SQL statement to see if it can be parsed successfully. Additionally, you can compare the problematic SQL statement with similar statements that are parsed correctly to identify any differences that may be causing the issue. | ||
|
|
||
| ## Pre Commit Checks | ||
| Run the following commands before you commit to ensure the change will pass the CI process: | ||
| ```bash | ||
| cargo test --all-features | ||
| cargo fmt --all | ||
| cargo clippy --all-targets --all-features -- -D warnings | ||
| ``` | ||
|
|
||
| ## Pull Request Guidelines | ||
| 1. PR title should follow this format: `<DIALECT>: <SHORT DESCRIPTION>`, For example, `Showflake: Add support for casting to VARIANT`. | ||
| 2. Make the PR comment short, provide an example of what was not working and a short description of the fix. Be succint. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is good