aim42 / htmlSanityCheck

Standalone (batch- and command-line) and Gradle-plugin html sanity checker - detects missing images, dead links and cross-references, duplicate link targets (anchors) and the like.
Apache License 2.0
68 stars 42 forks source link

Provide an extension to configure the default task #212

Open thc202 opened 6 years ago

thc202 commented 6 years ago

It's considered best practice to configure the default task through an extension.

This also has the advantage of providing a more similar configuration for Groovy and Kotlin DSLs.

Currently, in Groovy DSL you can simply do:

htmlSanityCheck {
    sourceDir = file("src/main/docs")
}

but in Kotlin DSL you need to be more explicit and get the task, e.g.:

tasks.named<org.aim42.htmlsanitycheck.HtmlSanityCheckTask>("htmlSanityCheck") {
    sourceDir = file("src/main/docs")
}

which is more verbose than the usual/ideal.

It might also be a good opportunity to start using lazy properties and task configuration avoidance.

gernotstarke commented 6 years ago

I'm open for suggestions on how to proceed here. Is it an urgent issue for you?

again, thanx for your research and contribution

thc202 commented 6 years ago

This can be implemented in Groovy (the Kotlin DSL is just another consumer), happy to contribute that.

No urgency, just a good to have.

ascheman commented 7 months ago

We are currently modularising HSC and therefore reorganising the complete build (cf. #309 and the develop branch of the project). Are you still interested in contributing a respective extension, @thc202? I'd be happy to see a PR.

You seem to be very familiar with Gradle. If you happen to have some time, reviewing the modular build, I'd appreciate any feedback as well.