Skip plugins block in UsePropertyAssignmentSyntax#7337
Merged
Conversation
The recipe was incorrectly converting `version '3.19'` inside
`plugins { }` blocks to `.version = '3.19'`. In the Gradle plugins
DSL, `version` is part of the plugin declaration syntax, not a
property assignment. Walk the cursor tree to detect and skip
method invocations inside plugins blocks.
Instead of checking cursor ancestry on each match, skip the super.visitMethodInvocation call for plugins blocks so their children are never visited.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UsePropertyAssignmentSyntaxwas incorrectly transformingversion '3.19'insideplugins { }blocks to.version = '3.19'versionis part of the declaration syntax, not a property assignmentpluginsblocks entirely — the visitor returns early without callingsuper.visitMethodInvocation, so children of thepluginsblock are never visitedTest plan
settings.gradleplugins block (pluginVersionUnchangedInPluginsBlock)build.gradleplugins block (pluginVersionUnchangedInBuildGradlePluginsBlock)versionoutside plugins block still converts (versionOutsidePluginsBlockConverted)