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

Improve accuracy of FixQuery rule #5438

Merged
merged 3 commits into from
Jul 25, 2024
Merged

Improve accuracy of FixQuery rule #5438

merged 3 commits into from
Jul 25, 2024

Conversation

clairemcginty
Copy link
Contributor

The accuracy of FixQuery was not good when used on @BigQueryType.from macros. By matching on the <macro>.query.from expression, we can pick up on the macro class's ClassSignature, which includes HasQuery as a parent.

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.11%. Comparing base (ce2825a) to head (aabb5c7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5438   +/-   ##
=======================================
  Coverage   61.11%   61.11%           
=======================================
  Files         311      311           
  Lines       11075    11075           
  Branches      764      764           
=======================================
+ Hits         6768     6769    +1     
+ Misses       4307     4306    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Patch.replaceTree(t, q"$qual.queryRaw".syntax)
case t @ q"$qual.query" if isQuery(t) =>
Patch.replaceTree(t, q"$qual.queryRaw".syntax)
case t @ q"$qual.query.format" if isQueryFormat(qual) =>
Patch.replaceTree(t, q"$qual.queryRaw.format".syntax)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we try to directly use query(..) in that case ?

Suggested change
Patch.replaceTree(t, q"$qual.queryRaw.format".syntax)
Patch.replaceTree(t, q"$qual.query".syntax)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified it to single case matching query directly 👍

@clairemcginty clairemcginty merged commit 0cc95ac into main Jul 25, 2024
12 of 13 checks passed
@clairemcginty clairemcginty deleted the has-query-rule branch July 25, 2024 15:05
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.

3 participants