hsc [ options ] [ sourceDirectory ]
HSC CLI Module
The Command Line Interface (CLI) module of HTML Sanity Check (HSC) enables to check generated or native HTML documentation from the command line.
Installation (Command Line Interface)
Prerequisites
-
Java 8 or higher (
java
executable required on the OS search path (${PATH} on Linux/macOS, `%path%
on Windows).
Download
Download the latest version of the HSC CLI from the release page.
Usage
The CLI tool can be executed with the following command.
If the sourceDirectory
is omitted, HSC uses the current directory as base-directory to search for HTML files.
- Linux / macOS
-
- Windows
-
hsc.bat [ options ] [ sourceDirectory ]
Options
The CLI tool exposes a few options as part of its configuration:
<sourceDirectory> (optional) |
Directory where the HTML files are located. Type: Directory Default: Currrent directory ( |
||
--sourceDocuments <…> (optional)
|
An override to process several source files, which must be a subset of all files available in Type: List of files Default: All files in |
||
--checkingResultsDir <…> (optional)
|
Directory where HSC writes the checking results. Type: Directory Default: |
||
--junitResultsDir <…> (optional)
|
Directory where HSC writes the results in JUnit XML format. JUnit XML can be read by many tools, including CI environments. Type: Directory Default: |
||
--failOnErrors (optional)
|
Fail the build if any error was found in the checked pages. Type: Boolean Default: |
||
--httpConnectionTimeout <value> (optional)
|
Timeout for HTTP requests in milliseconds. Type: Integer Default: |
||
--ignoreLocalHost (optional)
|
Ignore localhost as hostname. Type: Boolean Default: |
||
--ignoreIPAddresses (optional)
|
Ignore IP addresses as hostname. Type: Boolean Default: |
||
--checkerClasses <…> (optional)
|
The set of checker classes to be executed. Type: List Default: Checker Classes
|
||
--httpWarningCodes (optional)
|
HTTP response codes treated as warning. Type: List Default:
|
||
--httpErrorCodes (optional)
|
HTTP response codes treated as error. Type: List Default:
|
||
--httpSuccessCodes (optional)
|
HTTP response codes treated as success. Type: List Default:
|
Examples
Basic Example
java -jar htmlSanityCheck-cli-<version>.jar --sourceDir ./docs
Extended Example
java -jar htmlSanityCheck-cli-<version>.jar \
--sourceDir ./docs \
--checkingResultsDir ./report/htmlchecks \
--failOnErrors true \
--httpConnectionTimeout 1000 \
--checkerClasses DuplicateIdChecker,MissingImageFilesChecker
Compatibility
The CLI tool has been tested with the following Java versions:
-
Java 8
-
Java 11
-
Java 17
-
Java 21
Development Versions
In case you want to use a current development (or arbitrary branch or tag) version from GitHub, you can build the CLI tool from source.
- Clone the repository
-
git clone https://github.com/aim42/htmlSanityCheck.git cd htmlSanityCheck
- Build the CLI tool
-
./gradlew integrationTest
Gradle generates the application to
htmlSanityCheck-cli/build/install/hsc/
.
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.