Skip to content

Conversation

@egorikftp
Copy link
Member

Will be generated following code:

Screenshot 2025-12-08 at 19 18 35

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Walkthrough

The changes detect icon file names that collide with reserved Compose qualified names (Brush, Color, Offset) during image vector generation. GenerateImageVectorsTask collects conflicting full-qualified names, logs them, and passes them into the generation flow. ImageVectorGeneratorConfig is set to use full-qualified imports for those conflicts. A new FullQualifiedNamesTest class adds tests that verify full-qualified imports are applied and that direct imports of the reserved types are not emitted.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding automatic handling of full qualified imports for conflicting icon names in the Gradle plugin.
Description check ✅ Passed The description is related to the changeset, referencing issue #757 and indicating generated code will follow, though minimal detail is provided.
Linked Issues check ✅ Passed The PR implements automatic handling of full qualified imports for conflicting icon names (#757), detected through name collision checking and enforced during code generation.
Out of Scope Changes check ✅ Passed All changes are within scope: detection logic for reserved Compose qualifiers (Brush, Color, Offset), configuration propagation, test coverage, and CHANGELOG updates align with the stated objective.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/gradle/full-qualified

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f86553 and 5580fce.

📒 Files selected for processing (3)
  • tools/gradle-plugin/CHANGELOG.md (1 hunks)
  • tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt (7 hunks)
  • tools/gradle-plugin/src/test/kotlin/io/github/composegears/valkyrie/gradle/FullQualifiedNamesTest.kt (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tools/gradle-plugin/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/gradle-plugin/src/test/kotlin/io/github/composegears/valkyrie/gradle/FullQualifiedNamesTest.kt
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-07T20:07:49.744Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 750
File: tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt:71-85
Timestamp: 2025-12-07T20:07:49.744Z
Learning: In the Valkyrie Gradle plugin (Kotlin), the `useFlatPackage` flag in `IconPackExtension` is only applicable when nested packs are configured. For single icon packs (without nested packs), the flag is intentionally not propagated to `ImageVectorGeneratorConfig` as there is no package hierarchy to flatten.

Applied to files:

  • tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (ubuntu-latest)
🔇 Additional comments (6)
tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt (6)

6-7: LGTM!

The new imports are appropriate for implementing conflict detection and full-qualified import configuration.

Also applies to: 16-16


121-124: LGTM!

The propagation of fullQualifiedNames to both generation paths is correct and consistent.

Also applies to: 126-129


166-166: LGTM!

The method signature update and configuration correctly integrate the full-qualified imports feature.

Also applies to: 181-181


199-199: LGTM!

The method correctly propagates and applies the full-qualified imports configuration for icon pack generation.

Also applies to: 206-209


349-355: The hardcoded strings are correct and aligned with reservedComposeQualifiers.

The implementation correctly matches the constant definition listOf("Brush", "Color", "Offset"). Note that similar logic is duplicated in SvgXmlToImageVectorCommand.kt with the same inline hardcoded strings; extracting this into a shared utility function would eliminate duplication and reduce future maintenance risk.


104-114: Verify that IconNameFormatter correctly strips file extensions.

The conflict detection relies on IconNameFormatter.format(name = it.name) to transform file names (e.g., "Brush.svg") into formatted names (e.g., "Brush") that match reservedComposeQualifiers. The formatter correctly handles both .svg and .xml extensions via removeSuffix() calls and produces PascalCase output that aligns with the reserved qualifiers list ("Brush", "Color", "Offset"). This logic is sound and will correctly identify conflicting icon names for full qualified imports.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt (1)

166-187: Consider extracting config creation to reduce duplication.

The logic for creating FullQualifiedImports is duplicated in both generateIconsWithoutPack (lines 182-186) and generateIconsWithIconPack (lines 214-218). While the duplication is limited and the code is clear, extracting to a helper method would improve maintainability.

Example helper method:

private fun createFullQualifiedImports(fullQualifiedNames: List<String>): FullQualifiedImports {
    return FullQualifiedImports(
        brush = "Brush" in fullQualifiedNames,
        color = "Color" in fullQualifiedNames,
        offset = "Offset" in fullQualifiedNames,
    )
}

Then use: fullQualifiedImports = createFullQualifiedImports(fullQualifiedNames)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98429ee and 0f86553.

📒 Files selected for processing (3)
  • tools/gradle-plugin/CHANGELOG.md (1 hunks)
  • tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt (6 hunks)
  • tools/gradle-plugin/src/test/kotlin/io/github/composegears/valkyrie/gradle/FullQualifiedNamesTest.kt (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 750
File: tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt:71-85
Timestamp: 2025-12-07T20:07:49.744Z
Learning: In the Valkyrie Gradle plugin (Kotlin), the `useFlatPackage` flag in `IconPackExtension` is only applicable when nested packs are configured. For single icon packs (without nested packs), the flag is intentionally not propagated to `ImageVectorGeneratorConfig` as there is no package hierarchy to flatten.
📚 Learning: 2025-10-21T20:55:27.073Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 651
File: tools/idea-plugin/build.gradle.kts:147-175
Timestamp: 2025-10-21T20:55:27.073Z
Learning: In Gradle Kotlin DSL (.gradle.kts) scripts, the types `org.gradle.api.artifacts.ArtifactCollection` and `org.gradle.api.artifacts.component.ModuleComponentIdentifier` are implicitly available and do not require explicit import statements.

Applied to files:

  • tools/gradle-plugin/src/test/kotlin/io/github/composegears/valkyrie/gradle/FullQualifiedNamesTest.kt
📚 Learning: 2025-12-07T20:07:49.744Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 750
File: tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt:71-85
Timestamp: 2025-12-07T20:07:49.744Z
Learning: In the Valkyrie Gradle plugin (Kotlin), the `useFlatPackage` flag in `IconPackExtension` is only applicable when nested packs are configured. For single icon packs (without nested packs), the flag is intentionally not propagated to `ImageVectorGeneratorConfig` as there is no package hierarchy to flatten.

Applied to files:

  • tools/gradle-plugin/src/test/kotlin/io/github/composegears/valkyrie/gradle/FullQualifiedNamesTest.kt
  • tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (ubuntu-latest)
🔇 Additional comments (8)
tools/gradle-plugin/CHANGELOG.md (1)

3-9: LGTM! Documentation is clear.

The changelog entry accurately describes the new feature and follows the existing format.

tools/gradle-plugin/src/test/kotlin/io/github/composegears/valkyrie/gradle/FullQualifiedNamesTest.kt (3)

20-51: LGTM! Test coverage for Brush icon is solid.

The test correctly verifies both the log output and that the generated file omits the direct import statement.


53-84: LGTM! Test coverage for Color icon is solid.

Reusing ic_brush.xml content for different icon names is acceptable here since the tests focus on import behavior rather than icon rendering.


86-117: LGTM! Test coverage for Offset icon is solid.

The test suite comprehensively covers all three reserved Compose qualifiers (Brush, Color, Offset).

tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt (4)

6-7: LGTM! Required imports for the feature.

The imports support the conflict detection and configuration logic.

Also applies to: 16-16


104-114: LGTM! Conflict detection logic is correct.

The implementation efficiently detects icon names that conflict with reserved Compose qualifiers and provides clear user feedback via logging.


121-129: LGTM! Clean data flow.

The fullQualifiedNames are correctly propagated to both icon generation paths.


205-219: LGTM! Config creation is correct.

The implementation properly sets fullQualifiedImports based on detected conflicts and includes the icon pack name in the configuration.

@egorikftp egorikftp force-pushed the feature/gradle/full-qualified branch from 0f86553 to 5580fce Compare December 8, 2025 16:29
@egorikftp egorikftp merged commit 866bd45 into main Dec 8, 2025
3 checks passed
@egorikftp egorikftp deleted the feature/gradle/full-qualified branch December 8, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Gradle] Handle full qualified names

2 participants