1 minute to read
htmlSanityCheck
About This Task
This task invokes the htmlSanityCheck gradle plugin.
It is a standalone (batch- and command-line) HTML sanity checker whose role is to detect missing images, dead links and duplicated bookmarks.
In docToolchain, the htmlSanityCheck task ensures that generated HTML contains no missing links or other problems.
It is the last default task, and creates a report in build/reports/htmlchecks/index.html
(see example below).
Figure 1. sample report
Further Reading and Resources
-
Read the Automated Quality-Checks blog post.
-
Visit https://github.com/aim42/htmlSanityCheck for more information about this task.
Source
Show source code of scripts/htmlSanityCheck.gradle
or go directly to GitHub · docToolchain/scripts/htmlSanityCheck.gradle.
scripts/htmlSanityCheck.gradle
htmlSanityCheck {
sourceDir = new File(config.htmlSanityCheck.sourceDir?targetDir+"/"+config.htmlSanityCheck.sourceDir:"$targetDir/html5")
// files to check - in Set-notation
//sourceDocuments = [ "one-file.html", "another-file.html", "index.html"]
// where to put results of sanityChecks...
checkingResultsDir = new File(config.htmlSanityCheck.checkingResultsDir?:checkingResultsPath)
// directory where the results written to in JUnit XML format
junitResultsDir = new File(config.htmlSanityCheck.junitResultsDir?:"$targetDir/test-results/htmlchecks")
// which statuscodes shall be interpreted as warning, error or success defaults to standard
httpSuccessCodes = config.htmlSanityCheck.httpSuccessCodes?:[]
httpWarningCodes = config.htmlSanityCheck.httpWarningCodes?:[]
httpErrorCodes = config.htmlSanityCheck.httpErrorCodes?:[]
// fail build on errors?
failOnErrors = config.htmlSanityCheck.failOnErrors?:false
logger.info "docToolchain> HSC sourceDir: ${sourceDir}"
logger.info "docToolchain> HSC checkingResultsDir: ${checkingResultsDir}"
}
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.