Conversation
WalkthroughThe constructor of Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugin/src/main/kotlin/io/getstream/android/StreamConventionExtensions.kt (1)
35-38: Validation forrepositoryNamealready exists in SpotlessConfiguration—but it's scattered across modules rather than centralized.The review comment is incorrect in claiming there is no explicit validation.
SpotlessConfiguration.kt(lines 38–40) already enforces the mandatory requirement with a clear error message:val repositoryName = projectExtension.repositoryName.orNull ?: error("streamProject.repositoryName must be configured in the root project")However, the validation is incomplete and fragmented:
- Only enforced when SpotlessConfiguration is applied; other code paths may not validate until their specific feature runs
CoverageConfiguration.ktcalls.get()without explicit error handling;PublishingConfiguration.ktuses lazy.map()which defers errors to publishing time- A centralized check in
createProjectExtension()(or the plugin'sapply()method) would ensure consistent, early validation regardless of which feature is usedConsider centralizing the validation to guarantee users always get a clear error at configuration time, not at task execution time:
Suggested centralized validation
internal fun Project.createProjectExtension(): StreamProjectExtension = - extensions.create<StreamProjectExtension>("streamProject") + extensions.create<StreamProjectExtension>("streamProject").also { ext -> + afterEvaluate { + check(ext.repositoryName.isPresent) { + "streamProject.repositoryName must be configured in the root project. " + + "Add `streamProject { repositoryName = \"<your-repo-name>\" }` to your root build file." + } + } + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@plugin/src/main/kotlin/io/getstream/android/StreamConventionExtensions.kt` around lines 35 - 38, The repositoryName property on StreamProjectExtension is only validated in SpotlessConfiguration, leaving other consumers (e.g. CoverageConfiguration using .get(), PublishingConfiguration using .map()) to fail later; add a centralized, eager validation when the extension is created so misconfiguration is reported at configuration time: in the code path that constructs StreamProjectExtension (e.g. createProjectExtension() or the plugin apply() method), read projectExtension.repositoryName.orNull and immediately throw/error with the same clear message used in SpotlessConfiguration if null, ensuring all features see the same early validation rather than relying on per-feature checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@plugin/src/main/kotlin/io/getstream/android/StreamConventionExtensions.kt`:
- Around line 35-38: The repositoryName property on StreamProjectExtension is
only validated in SpotlessConfiguration, leaving other consumers (e.g.
CoverageConfiguration using .get(), PublishingConfiguration using .map()) to
fail later; add a centralized, eager validation when the extension is created so
misconfiguration is reported at configuration time: in the code path that
constructs StreamProjectExtension (e.g. createProjectExtension() or the plugin
apply() method), read projectExtension.repositoryName.orNull and immediately
throw/error with the same clear message used in SpotlessConfiguration if null,
ensuring all features see the same early validation rather than relying on
per-feature checks.
|
🚀 Available in v0.10.0 |
Up until now, the repository name is not mandatory to set and we default to the project name. The repo name, in turn, is used in things like spotless headers and urls.
I realized that this has the downside that if you locally rename the project folder, Spotless will try to change all headers because the project name is inherited from the name of the folder. Instead we should set it explicitly, so I'm making it mandatory.
Summary by CodeRabbit