rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

Find API calls recipe returns test results

Open mike-solomon opened this issue 2 years ago • 2 comments

In Moderne, when I run the Find API calls recipe on the Default organization, I notice that most of the results are tests rather than actual API calls:

image

Link to the test code

In looking into those test files, I see that the calls are being mocked. I'm not sure how feasible it would be, but can this recipe be tuned to not return results like that? Or am I perhaps misunderstanding something?

I would expect this recipe to return external API calls and not test/mocked ones.

mike-solomon avatar Aug 28 '23 18:08 mike-solomon

@mike-solomon Yes, I agree. We could probably use the JavaSourceSet to figure this out. Unfortunately we don't (yet) have a test property on SourceSet. I think we have up until now just been checking the name of the source set. But with Gradle and Bazel the source set names can practically be anything, so having a property would make more sense, IMHO.

knutwannheden avatar Aug 29 '23 08:08 knutwannheden

I added a feature request for this: https://github.com/openrewrite/rewrite/issues/3512

knutwannheden avatar Aug 29 '23 08:08 knutwannheden