The HSC CLI needs Java 8 (java executable) or higher on the respective OS search path (${PATH} on Linux/macOS, %path% on Windows).
If you use SDKMAN, you can install HSC as SDKMAN candidate: sdk install hsc.
Alternatively,
-
Download the HSC CLI from the release page.
-
Unpack the file in a convenient place, e.g.,
/usr/local/hsc.
Execute the CLI tool with the following command.
If the sourceDirectory is omitted, HSC uses the current directory as base-directory to search for HTML files.
- Linux / macOS
-
hsc [ options ] [ sourceDirectory ]
- Windows
-
hsc.bat [ options ] [ sourceDirectory ]
The CLI tool exposes a few options as part of its configuration:
| <sourceDirectory> (optional) |
HSC searches this directory for HTML files. Type: Directory Default: Current 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. Many tools can read JUnit XML, including CI environments. Type: Directory Default: |
||
--failOnErrors (optional)
|
Fail the build if HSC detected any error in the checked pages. Type: Boolean Default: |
||
--httpConnectionTimeout <value> (optional)
|
Timeout for HTTP requests in milliseconds. Type: Integer Default: |
||
--ignoreLocalHost (optional)
|
Ignore localhost as the 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
link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/AllCheckers.java[role=include] |
||
--excludes (optional)
|
This is a set of regular expressions of URLs or even hosts that HSC should not check. Type: Set. Default: Empty list [] |
||
--httpWarningCodes (optional)
|
HTTP response codes are treated as warning. Type: List Default: link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java[role=include]
// Redirects included
link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java[role=include]
|
||
--httpErrorCodes (optional)
|
HTTP response codes which are treated as errors. Type: List Default: link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java[role=include] |
||
--httpSuccessCodes (optional)
|
HTTP response codes that HSC treats as success. Type: List Default: link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java[role=include] |
We test the HSC CLI tool with the following Java versions:
-
Java 8
-
Java 11
-
Java 17
-
Java 21
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/.