-
Notifications
You must be signed in to change notification settings - Fork 455
Fixing the application of DoesNotIncludeDependency
against files of the incorrect type.
#5758
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
Fixing the application of DoesNotIncludeDependency
against files of the incorrect type.
#5758
Conversation
956aabf
to
bece592
Compare
rewrite-gradle/src/main/java/org/openrewrite/gradle/search/DoesNotIncludeDependency.java
Outdated
Show resolved
Hide resolved
I'm not sure I understand exactly what the issue is here. rewrite/rewrite-core/src/main/java/org/openrewrite/Preconditions.java Lines 65 to 67 in 41ce444
Preconditions.not marks every sourcefile that is not acceptable, but if the recipes(visitors) that come after that have the appropriate isAcceptable checks, that's fine right?
|
6a96f31
to
33cd43e
Compare
The problem was that when it would call the |
… the incorrect type.
…igher level shared recipe.
33cd43e
to
1e0aa4a
Compare
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; thanks for the fix here! We'll keep an eye on the for now only use downstream:
https://github.com/openrewrite/rewrite-testing-frameworks/blob/366deb6292a0e17daf021268e5acfc7550ce859f/src/main/resources/META-INF/rewrite/junit5.yml#L136-L146
What's changed?
Reworked the visitor for
DoesNotIncludeDependency
(both versions) so that it will first check that the file would have been accepted byDependencyInsight
's visitor before trying to visit it, and then only if an acceptable file was not marked, will it return a found result with that file in it.What's your motivation?
Previously there was a bug wherein if you applied
DoesNotIncludeDependency
to a file of a conceptually inapplicable type (i.e. a Java or Gradle file for the Maven version or a Java or POM file for the Gradle version), it would end up marking the file because the visitor forDependencyInsight
in each case was being run through the preconditionnot
.Checklist