GitHub Code Scanning
Thanks to the newly added SARIF formatter, HTMLHint can now be integrated with GitHub Code Scanning to automatically check your HTML code.

This integration can help maintain code quality and ensures that HTML standards are met across your projects. Fixing issues will automatically remove the warnings from the Code Scanning tab in GitHub.
Setting Up GitHub Code Scanning
Section titled “Setting Up GitHub Code Scanning”To set up HTMLHint with GitHub Code Scanning, you need to create a workflow file in your repository. This file will define the steps to run HTMLHint on your HTML files whenever a pull request is made.
- Create a Workflow File: In your repository, create a directory named
.github/workflows
if it doesn’t already exist. Inside this directory, create a file namedhtmlhint.yml
. - Define the Workflow: Add the following content to
htmlhint.yml
:
name: HTMLHint (SARIF) Code Scanningon: pull_request: branches: - main workflow_dispatch:
jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4
- name: Set up Node.js uses: actions/setup-node@v4
# If you need a website build script, include the steps here
- name: Run HTMLHint (SARIF) run: npx htmlhint . --format sarif || true # Continue even if HTMLHint finds issues
- name: Upload SARIF file uses: github/codeql-action/upload-sarif@v3 with: sarif_file: website/htmlhint.sarif category: HTMLHint if: always()
For a real-world example, you can see the Upload SARIF steps in the workflow for the HTMLHint website in the HTMLHint GitHub repository.
Make sure to adjust the sarif_file
path to match where HTMLHint outputs the SARIF file in your project.