canonical / canonical/devpack-for-spring-cli
Improve plugin id search in subprojects block
- Dominant language
- Java
- Stars
- 1
- Forks
- 5
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 31
Description
```
─── src/main/java/com/canonical/devpackspring/rewrite/visitors/FindMethodVisitor.java:47-50 ───
[bug · medium] In `containsLiteral`, the plugin-id literal is matched *anywhere* inside the `apply`
invocation subtree (including nested expressions/arguments such as a `from`/`to` map entry), not
specifically the plugin argument. Combined with `find(subtree, METHOD_APPLY, true)` (recursive), an
`apply` call in a `subprojects` block that happens to contain the plugin id string in an unrelated
nested argument would be treated as "plugin already applied" and
`AddPluginVisitorSupport.handleSubprojectsBlock` would skip adding the `apply plugin` statement.
Consider matching only the expected argument position (e.g., the `plugin:`/`plugin =` argument)
instead of any literal in the subtree.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with src/main/java/com/canonical/devpackspring/rewrite/visitors/FindMethodVisitor.java:47-50, especially containsLiteral and its use with find(subtree, METHOD_APPLY, true). Trace AddPluginVisitorSupport.handleSubprojectsBlock to confirm how this match controls insertion. Done when an unrelated nested argument does not count as an existing plugin application while the expected plugin argument still does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 76/100