Skip to content

sample full plugin configuration in docs is out of sync with actual implementation #284

@RBusarow

Description

@RBusarow

The current documented config is incorrect. A couple of the property names are wrong (they were unreleased names used in development).

There should be Gradle TestKit tests which feature the full config -- one for Groovy, and one for Kotlin.

A vanilla test like this which just runs ./gradlew modulecheck would be enough to validate that every referenced property actually exists.

In order to ensure that any new properties/child extensions are also documented/tested, reflection can be used. Something like ModuleCheckSettings::class.declaredMemberProperties.size shouldBe 11. If a property's added, the test breaks until it's also added to the test.

The config used in the test should be automatically synced to the configuration.mdx file via a Gradle task.

The mdx file should reference the path of the test, probably down to the property name. Like ./modulecheck-gradle-plugin/src/test/kotlin/modulecheck/gradle/ConfigValidationTest.kt and ConfigValidationTest.kotlinSample where kotlinSample is a String with the full config.

The task should fail if the test or property can't be resolved. Resolution (and parsing) can be done simply via PSI.

This is similar to kotlinx-knit.

Add two comments inside the file where the code sample should be injected. Everything in between the two comments will be replaced by the injected code.

<!--- 
INJECT_SAMPLE 
file=modulecheck-gradle-plugin/src/test/kotlin/modulecheck/gradle/ConfigValidationTest.kt 
sample=ConfigValidationTest.kotlinSample 
language=kotlin
-->

<!--- END_SAMPLE -->

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions