Using axe DevTools Linter Connector

Link to Using axe DevTools Linter Connector copied to clipboard

Command-line options, environment variables, set up information, and configuration file information for axe DevTools Linter Connector

Free Trial

axe DevTools Linter Connector is a command-line tool for Linux, macOS, and Windows. It provides a command-line interface to send files to axe DevTools Linter so that you can automate your accessibility checking. You can, for instance, use it for scripting and CI/CD (continuous integration and continuous delivery).

Example usage includes:

  • You can use axe DevTools Linter Connector to check accessibility as part of Jenkins builds. For more information, see Using axe DevTools Linter with Jenkins.
  • You can use the tool to scan your files and feed information about accessibility defects into SonarQube. See Using axe DevTools Linter with SonarQube for information on how to set this up.
  • It's used in the example GitHub pre-commit script to block commits that contain accessibility errors. See Using a Git Pre-Commit Hook with axe DevTools Linter.
  • It can provide a foundation for checking your code for accessibility defects for such services as:
    • Bitbucket
    • CircleCI
    • GitLab
    • Azure DevOps Services


For information on downloading axe DevTools Linter Connector, see Downloading the axe DevTools Linter Connector.

On Linux and macOS, the command file needs its execute flag set, as shown below:

chmod +x axe-linter-connector-linux
chmod +x axe-linter-connector-macos

When you download the executable on macOS, the quarantine attribute is set, which you need to delete before you can use the connector:

xattr -d axe-linter-connector-macos

Rename the executable (to drop the operating system and hyphen from the end of the file name) and copy or link it into a directory on your path so it can be used with other tools (such as with a Git pre-commit hook, see Using a Git Pre-Commit Hook with axe DevTools Linter).

Environment Variables

You need to set two environment variables to use the Connector. They are:


The first environment variable is the URL for your axe DevTools Linter instance. The second environment variable is the port the server is listening on and is typically port 3000.

See Setting up axe DevTools Linter for more information about setting up your server, and see URL Quick Reference for the URL for use with the SaaS version of axe DevTools Linter. (You do not need to specify a port when using the SaaS version of axe DevTools Linter.)

The following example shows how to set up a typical environment for axe DevTools Linter running on the local machine on Linux or macOS:

export AXE_LINTER_SERVER_URL=http://localhost

On Linux and macOS, you can also set the environment variables when running the connector command, as shown below:

AXE_LINTER_SERVER_PORT=3000 AXE_LINTER_SERVER_URL=http://localhost axe-linter-connector -s . -d .

If no environment variables are set, Connector defaults to using localhost on port 3000.

Command-Line Options

Required Command-Line Options

axe DevTools Linter Connector requires the following two options:

-s, --source directory-or-file
Indicates a file or the directory containing files to check for accessibility errors. Subdirectories are also searched. To exclude files from being linted, see the exclude option in the Configuration File section.

-d, --destination directory
Directory where Connector will write the accessibility report.

-u, --url URL
Specifies the server to use. The default is http://localhost. To use the SaaS server, specify --url

Optional Command-Line Options

There are several options that might be required depending on which server you are connecting to and what other features or report formats you want to use.

--api-key api-key
Specifies the API key to use to connect to the SaaS axe DevTools Linter instance. See Obtaining an axe DevTools Linter SaaS API Key for more information.

--config filename
Specifies the name of a YAML file containing configuration information. You can also use this option without a filename, and axe DevTools Connector will follow the steps in Multiple Configuration Files to locate configuration files. For information about the configuration file, see Configuration File.

--filename filename
Specifies the name of SonarQube report, default: axe-linter-report.json

--issue-type type
Used to indicate the issue type for SonarQube, default: BUG, allowed values: VULNERABILITY, CODE_SMELL, or BUG

-R, --reporter reporter
Specifies the reporter to use, default: sonarqube

--severity level
Sets the severity level for SonarQube, default: MAJOR, allowed values: BLOCKER, CRITICAL, MAJOR, MINOR, or INFO

Configuration File

You can use a YAML configuration file with the --config option.

The following shows an example configuration file:

  image-alt: false

  - meta-refresh.html

  - wcag2a

In the above example, the rule image-alt will be ignored and the file meta-refresh.html will not be linted. The rules in the wcag2a tag will be used, as specified in the tags section. (See Tags for more information.)

The exclude value allows glob values (*) and globstar (**), so the following is allowed:

  - tmp/**/*.html

The above example would exclude any HTML files in the tmp directory or any of its subdirectories.

For more information about allowed configuration options, see Configuring axe DevTools Linter.

Example Usage

The following shows how to use Connector to check files in the current directory (and subdirectories) and write a report to the current directory:

axe-linter-connector -s . -d . --url

The command produces a report, axe-linter-report.json, which describes any accessibility issues in the files that were submitted to the server.

To use Connector with the axe DevTools Linter SaaS server, you can use the api-key option as shown below:

axe-linter-connector -s . -d . --api-key 83cc5831-a35b-4a2d-9c2b-84fd2eec0a4d  --url