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

Scalafix: Add Avro coder import for SpecificRecord JobTest IOs #5237

Merged
merged 4 commits into from
Feb 13, 2024

Conversation

clairemcginty
Copy link
Contributor

No description provided.

@@ -128,6 +133,19 @@ class FixAvroCoder extends SemanticRule("FixAvroCoder") {
// Coder[T] is a variable type where T is an avro type
findMatchingValTypeParams(t, CoderMatcher)
.exists(isAvroType)
case q"$jobTestBuilder(..$args)" if JobTestBuilderMatcher.matches(jobTestBuilder) =>
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 spent some time trying to make this generic, so that it would match any function with an implicit coder evidence T, by inspecting each function argument for one that matched type T, but it got pretty complex/edge-casey. Not sure it's worth it

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (106b34a) 62.64% compared to head (ed3ce34) 62.63%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5237      +/-   ##
==========================================
- Coverage   62.64%   62.63%   -0.01%     
==========================================
  Files         301      301              
  Lines       10849    10849              
  Branches      745      745              
==========================================
- Hits         6796     6795       -1     
- Misses       4053     4054       +1     

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

Comment on lines +161 to +162
case importer"com.spotify.scio.avro.{..$imps}" =>
imps.map(i => Patch.removeImportee(i) + Patch.addGlobalImport(avroImport)).asPatch
Copy link
Contributor

Choose a reason for hiding this comment

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

This may have an impact on import alias, but I think this is still worth it

@clairemcginty clairemcginty merged commit b8462dc into main Feb 13, 2024
12 checks passed
@clairemcginty clairemcginty deleted the scalafix-avro-io branch February 13, 2024 13:27
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