Skip to content

Add tests with Groovy and fix 2 bugs.#16

Merged
smillst merged 7 commits intomainfrom
addGroovyTests
Feb 4, 2026
Merged

Add tests with Groovy and fix 2 bugs.#16
smillst merged 7 commits intomainfrom
addGroovyTests

Conversation

@smillst
Copy link
Member

@smillst smillst commented Feb 4, 2026

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

This pull request releases version 1.0.2 with test infrastructure refactoring and plugin implementation updates. The version is bumped in build configuration and documentation. The test base class AbstractPluginFunctionalTest is renamed to KotlinPluginFunctionalTest, and a new GroovyPluginFunctionalTest abstract class is introduced for Groovy-based functional tests. A new functional test class CFGroovyPluginFunctionalTest is added extending the Groovy base. The main plugin implementation wraps configuration logic in a doFirst block, moves checker validation into a guarded section, and broadens the test name detection regex pattern for more permissive matching.

🚥 Pre-merge checks | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✏️ 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 addGroovyTests

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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/functionalTest/kotlin/org/checkerframework/plugin/gradle/Fixtures.kt (1)

28-36: ⚠️ Potential issue | 🟡 Minor

Fix package-directory mismatch in writeTestClass(). Test.java declares package test; but is placed directly in src/test/java instead of src/test/java/test. This breaks the pattern used consistently by writeEmptyClass() (line 13) and writeNullnessFailure() (line 45) and may cause tooling issues. Align the path with the package declaration:

Suggested fix
-  File(this.resolve("src/test/java").apply { mkdirs() }, "Test.java").apply {
+  File(this.resolve("src/test/java/test").apply { mkdirs() }, "Test.java").apply {
src/main/kotlin/org/checkerframework/plugin/gradle/CheckerFrameworkPlugin.kt (1)

106-143: ⚠️ Potential issue | 🟠 Major

Avoid mutating JavaCompile inputs inside doFirst—this breaks incremental builds and build caching.

Lines 106–139 mutate options.annotationProcessorPath and options.compilerArgs during execution. Gradle snapshots task inputs before doFirst runs (immediately before execution). Any mutations in doFirst create a mismatch: the pre-execution snapshot won't match the execution history persisted from the previous run, causing the task to appear out-of-date on subsequent builds even when inputs haven't actually changed. This is a known Gradle caching problem.

Move these mutations to configuration time (when tasks are configured, not when they execute), or express them as inputs via lazy Provider-based properties or the compilerArgumentProviders API so Gradle can properly track them. At minimum, declare the manifest directory as an input:

Mitigation: declare manifest as input
       dependsOn("writeCheckerManifest")
+      inputs.dir(cfManifestDir)

Better: move the entire doFirst block logic to configuration time (a separate Task.doFirst equivalent that runs during configureEach), or use lazy properties.

🤖 Fix all issues with AI agents
In
`@src/functionalTest/kotlin/org/checkerframework/plugin/gradle/CFGroovyPluginFunctionalTest.kt`:
- Around line 11-23: The appended plugin/repositories block uses trimIndent()
which removes trailing blank lines so subsequent buildFile.appendText calls can
run together (e.g., merging "}" with following blocks); update the code that
calls buildFile.appendText(...) for this block (the string passed to
buildFile.appendText) to ensure it ends with an explicit newline (for example
append "\n" or include a final blank line after trimIndent) so subsequent
appendText calls like the one adding compileJava{} remain separated.

Comment on lines +11 to +23
buildFile.appendText(
"""
plugins {
id("java")
id("org.checkerframework")
}
repositories {
mavenCentral()
}

"""
.trimIndent()
)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid relying on trailing whitespace for block separation.

trimIndent() strips trailing blank lines, so this block likely ends without a newline. The later appendText() calls can concatenate } and compileJava{} unless the trailing spaces survive formatting. Add an explicit newline to make the separation robust.

🔧 Suggested fix
-    buildFile.appendText(
-      """
-      plugins {
-          id("java")
-          id("org.checkerframework")
-      }
-      repositories {
-          mavenCentral()
-      }         
-
-      """
-        .trimIndent()
-    )
+    buildFile.appendText(
+      """
+      plugins {
+          id("java")
+          id("org.checkerframework")
+      }
+      repositories {
+          mavenCentral()
+      }
+      """.trimIndent() + "\n"
+    )
🤖 Prompt for AI Agents
In
`@src/functionalTest/kotlin/org/checkerframework/plugin/gradle/CFGroovyPluginFunctionalTest.kt`
around lines 11 - 23, The appended plugin/repositories block uses trimIndent()
which removes trailing blank lines so subsequent buildFile.appendText calls can
run together (e.g., merging "}" with following blocks); update the code that
calls buildFile.appendText(...) for this block (the string passed to
buildFile.appendText) to ensure it ends with an explicit newline (for example
append "\n" or include a final blank line after trimIndent) so subsequent
appendText calls like the one adding compileJava{} remain separated.

@smillst smillst merged commit 76975e4 into main Feb 4, 2026
57 checks passed
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.

1 participant