Skip to content

Make repositoryName mandatory#18

Merged
gpunto merged 1 commit intodevelopfrom
mandatory-reponame
Feb 24, 2026
Merged

Make repositoryName mandatory#18
gpunto merged 1 commit intodevelopfrom
mandatory-reponame

Conversation

@gpunto
Copy link
Copy Markdown
Collaborator

@gpunto gpunto commented Feb 19, 2026

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

  • Refactor
    • Updated plugin configuration architecture to improve dependency handling. The repository name configuration may require explicit setup if your project relied on automatic defaults.

@gpunto gpunto marked this pull request as ready for review February 19, 2026 15:39
@gpunto gpunto requested a review from a team February 19, 2026 15:39
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 19, 2026

Walkthrough

The constructor of StreamProjectExtension was refactored to use dependency injection with only ObjectFactory parameter, removing the Project parameter. The repositoryName property's default convention that referenced the root project name was removed, requiring explicit configuration.

Changes

Cohort / File(s) Summary
Dependency Injection Refactoring
plugin/src/main/kotlin/io/getstream/android/StreamConventionExtensions.kt
Constructor simplified to accept only ObjectFactory parameter via @Inject annotation, removing Project dependency. Default convention for repositoryName property removed; property now initializes without a default value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A constructor trimmed down with care,
Dependencies lighter through the air,
No project passed, just objects pure,
The rabbit's refactor, clean and sure! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Make repositoryName mandatory' directly reflects the main objective: changing repositoryName from an optional property with a default convention to a mandatory required configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 mandatory-reponame

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
Copy Markdown

@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.

🧹 Nitpick comments (1)
plugin/src/main/kotlin/io/getstream/android/StreamConventionExtensions.kt (1)

35-38: Validation for repositoryName already 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.kt calls .get() without explicit error handling; PublishingConfiguration.kt uses lazy .map() which defers errors to publishing time
  • A centralized check in createProjectExtension() (or the plugin's apply() method) would ensure consistent, early validation regardless of which feature is used

Consider 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.

@gpunto gpunto merged commit 809d1f3 into develop Feb 24, 2026
3 checks passed
@gpunto gpunto deleted the mandatory-reponame branch February 24, 2026 10:05
@stream-public-bot stream-public-bot added the released Included in a release label Mar 19, 2026
@stream-public-bot
Copy link
Copy Markdown
Collaborator

🚀 Available in v0.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants