Skip to content

Clean up - #27

Merged
Vladyslav-Kuksiuk merged 7 commits into
masterfrom
clean-up
Jul 28, 2026
Merged

Clean up#27
Vladyslav-Kuksiuk merged 7 commits into
masterfrom
clean-up

Conversation

@Vladyslav-Kuksiuk

Copy link
Copy Markdown
Collaborator

This PR:

  • Added README validation and updated the plugin version example.
  • Clarified ownership rules for proofreading project files.
  • Added Detekt analysis for buildSrc and included it in CI checks.
  • Expanded dependency POM generation test coverage.
  • Added Dokka-generated Kotlin API documentation to the Javadoc artifact.
  • Updated generated dependency and license reports.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this Jul 28, 2026
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk marked this pull request as ready for review July 28, 2026 09:53
Comment on lines +296 to +301
val fields = decodeTaskInput(expectedFieldCount = 4).iterator()
return DeclaredDependency(
group = group,
artifact = artifact,
configuredVersion = configuredVersion.takeIf(String::isNotEmpty),
configurationName = configurationName,
group = fields.next(),
artifact = fields.next(),
configuredVersion = fields.next().takeIf(String::isNotEmpty),
configurationName = fields.next(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should fix — decoding now depends on named-argument evaluation order.

The previous val (group, artifact, configuredVersion, configurationName) = decodeTaskInput(expectedFieldCount = 4) bound fields positionally: order-independent and arity-checked by the compiler. The iterator form is correct only because Kotlin evaluates call arguments in source order, so reordering these named arguments — a normally safe, IDE-suggested edit — would silently misassign configuredVersion and configurationName with no compile error.

toResolvedVersion() at line 305 still destructures, so the two sibling decoders now read differently for no stated reason. If the rewrite was needed to satisfy Detekt's DestructuringDeclarationWithTooManyEntries (default maxDestructuringEntries: 3), which now applies to buildSrc for the first time, that is worth a comment.

Smallest safe correction: keep the decoded List and index it (fields[0]fields[3]), which restores positional binding without a 4-entry destructuring.

Comment on lines +5 to +9
This repository has no `.gitmodules`, so it has no submodule contents or
`config`-distributed files to exclude. Treat every tracked path as project-owned,
including `buildSrc/`, `AGENTS.md`, `CLAUDE.md`, `gradle.properties`,
`.github/copilot-instructions.md`, and `.idea/`. Its `config/` directory contains
project-owned Detekt configuration.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should fix — .idea/ is not a tracked path in this repository.

The sentence says "Treat every tracked path as project-owned, including … and .idea/", but .idea/ is ignored here (.gitignore:3) and git ls-files .idea returns nothing. The other four paths named are tracked; only this one is not.

This page is the authority agents consult before editing files, so a path that does not exist in the repo weakens it. Either drop .idea/ from the list, or say explicitly that it is ignored here and therefore out of scope.

Comment on lines +102 to +103
fun `compare numeric version segments numerically`() {
assertTrue(dependencyVersionComparator.compare("1.10", "1.9") > 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should fix — one assertion for a comparator that was widened to internal in order to test it.

dependencyVersionComparator went from private to internal for this test, but only 1.10 > 1.9 is covered. Replaying the comparator's algorithm (Regex("""\d+|\D+""") segments, then firstSegments.size.compareTo(secondSegments.size) as the tie-break) shows two unverified behaviours:

comparison result selected by maxWith
2.0.0-alpha.5 vs 2.0.0 +1 2.0.0-alpha.5
1.0.0-RC1 vs 1.0.0 +1 1.0.0-RC1
1.09 vs 1.9 0 either

A prerelease outranks its own release because it simply has more segments. selectDependencies picks resolvedVersions[id]?.maxWithOrNull(dependencyVersionComparator), so a module resolving to both an alpha and its release would be documented at the alpha — and the build already carries dev.detekt:…:2.0.0-alpha.5.

The comparator body is pre-existing and unchanged by this PR; impact is confined to the generated pom.xml and dependencies.md, never the published artifact. Since the PR is what makes the comparator testable, this is the natural place to add prerelease and leading-zero cases (and to decide whether the current ordering is intended).

Comment on lines +125 to +127
tasks.register<Jar>("javadocJar") {
description = "Packages Kotlin API documentation generated by Dokka."
archiveClassifier.set("javadoc")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit — the replacement task loses the build group.

The ordering trick works: Gradle's withJavadocJar() guards with if (!tasks.getNames().contains(jarTaskName)), so this task is reused and wired into javadocElements. Verified locally — ./gradlew :gradle-plugin:javadocJar produces a 640 KB jar with 120 Dokka HTML entries.

One detail is dropped, though: the task Gradle would have created also sets group = BasePlugin.BUILD_GROUP. Because this one only sets description, ./gradlew :gradle-plugin:tasks --all now lists javadocJar under Other tasks, while sourcesJar stays under Build tasks. Adding group = LifecycleBasePlugin.BUILD_GROUP restores the parity.

Comment on lines +31 to +35
dokka {
dokkaPublications.html {
moduleName.set("embed-code-gradle-plugin")
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit — a shared convention hardcodes one module's name.

dokka-configuration lives in buildSrc alongside jvm-module, so it reads as reusable, but moduleName is pinned to embed-code-gradle-plugin. A second module applying it would publish its API documentation under the wrong name, silently.

Either derive it (base.archivesName, which gradle-plugin/build.gradle.kts:121 already sets to the same value), or leave the convention to apply and configure the plugin and move the moduleName override into gradle-plugin/build.gradle.kts where the name belongs. Not blocking while there is exactly one consumer.

Comment on lines +47 to +48
@TempDir
lateinit var projectDirectory: Path

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit — the field name does not describe what the directory holds.

This is not the Gradle project's directory: every test builds its project with ProjectBuilder.builder().build(), which allocates its own temporary directory. This @TempDir is only the parent of the fixture Maven repository created by createMavenModule, and only one test reads it. repositoryRoot (or similar) would say so.

@Oleg-Melnik Oleg-Melnik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Vladyslav-Kuksiuk LGTM with comments to address.

@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk merged commit 6d839ff into master Jul 28, 2026
3 checks passed
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk deleted the clean-up branch July 28, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants