-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
AnySetOf
grammar
#2326
AnySetOf
grammar
#2326
Conversation
…jpy-git/sqlfluff into create_table_references_grammar
Codecov Report
@@ Coverage Diff @@
## main #2326 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 159 159
Lines 11303 11313 +10
=========================================
+ Hits 11303 11313 +10
Continue to review full report at Codecov.
|
Will take a look at adding some additional tests for coverage tomorrow, the PR is otherwise passing though. |
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.
Looks good! I think there may be a possibility of simplifying the logic a little.
and (str(matched_option) in available_option_counter) | ||
): | ||
available_option_counter[str(matched_option)] += 1 | ||
# Check if we have matched an option too many times. |
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.
Could this be moved inside the if
above? It may be possible to simplify the logic as well -- IIUC, we only need to check if matched_option
has hit the maximum.
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.
@barrywhart good shout, I've simplified the logic by moving the if condition 👍
Brief summary of the change made
Closes #2322. Adds
AnySetOf
grammar.AnySetOf
is defined asMatch any number of the elements but each element can only be matched once.
I've updated the grammar introduced in #2315 to use this new segment.
Happy to convert a couple places in the grammar/add extra tests if needed (this is my first time updating the parser code).
Are there any other side effects of this change that we should be aware of?
No
Pull Request checklist
Please confirm you have completed any of the necessary steps below.
Included test cases to demonstrate any code changes, which may be one or more of the following:
.yml
rule test cases intest/fixtures/rules/std_rule_cases
..sql
/.yml
parser test cases intest/fixtures/dialects
(note YML files can be auto generated withtox -e generate-fixture-yml
).test/fixtures/linter/autofix
.Added appropriate documentation for the change.
Created GitHub issues for any relevant followup/future enhancements if appropriate.