Configuring Super-Linter

Super-Linter is highly configurable to fit the needs of any project. You can control its behavior using environment variables and by providing your own linter configuration files.

Configuration via Environment Variables

Environment variables are the primary way to configure Super-Linter's behavior. You can use them to enable or disable linters, activate fix mode, filter files, and more.

Below is a comprehensive list of available environment variables. For detailed examples, refer to the README.md file in the repository.

Environment variable Default Value Description
ANSIBLE_CONFIG_FILE .ansible-lint.yml Filename for Ansible-lint configuration.
ANSIBLE_DIRECTORY /ansible Root directory for Ansible files relative to DEFAULT_WORKSPACE. Set to . to use the top-level.
BASH_EXEC_IGNORE_LIBRARIES false If true, shell files with an extension but no shebang are ignored for executable bit checks.
BASH_FILE_NAME .shellcheckrc Filename for Shellcheck.
BASH_SEVERITY Shellcheck default Minimum severity of errors for shellcheck (error, warning, info, style).
CHECKOV_FILE_NAME .checkov.yaml Configuration filename for Checkov.
CLANG_FORMAT_FILE_NAME .clang-format Configuration filename for clang-format.
CREATE_LOG_FILE false If true, creates a log file (super-linter.log by default).
CSS_FILE_NAME .stylelintrc.json Filename for Stylelint configuration.
DEFAULT_BRANCH main or repo default The name of the repository's default branch. Automatically detected in GitHub Actions.
DEFAULT_WORKSPACE /tmp/lint The directory containing files to lint when running locally.
DISABLE_ERRORS false If true, the action completes with exit code 0 even if errors were found.
DOCKERFILE_HADOLINT_FILE_NAME .hadolint.yaml Filename for hadolint configuration.
EDITORCONFIG_FILE_NAME .editorconfig-checker.json Filename for editorconfig-checker configuration.
FILTER_REGEX_EXCLUDE not set Regex to exclude files from linting (e.g., .*src/test.*).
FILTER_REGEX_INCLUDE not set Regex to include files for linting. Evaluated before FILTER_REGEX_EXCLUDE.
FIX_... false A series of FIX_[LANGUAGE] variables to enable auto-fixing for supported formatters. See Fixing Errors.
IGNORE_GENERATED_FILES false If true, ignores files containing a @generated marker.
IGNORE_GITIGNORED_FILES false If true, ignores files listed in .gitignore.
LINTER_RULES_PATH .github/linters Directory for all linter configuration files.
LOG_LEVEL INFO Log verbosity: ERROR, WARN, NOTICE, INFO, or DEBUG.
RUN_LOCAL false Set to true when running outside GitHub Actions.
VALIDATE_ALL_CODEBASE true If false, only new or edited files are linted. If true, the entire codebase is scanned.
VALIDATE_... true A series of VALIDATE_[LANGUAGE] variables to enable or disable specific linters.

Enabling and Disabling Linters

The VALIDATE_[LANGUAGE] variables follow a specific logic:

  • By default, all linters are enabled.
  • If you set any VALIDATE_[LANGUAGE] variable to false, only that linter is disabled, and all others remain enabled.
  • If you set any VALIDATE_[LANGUAGE] variable to true, Super-Linter switches to an "opt-in" mode: only the linters explicitly set to true will run.
  • You cannot mix true and false values for different VALIDATE_[LANGUAGE] variables; this will result in a configuration error.

Configuration via Files

For many linters, you can provide your own configuration files to override the default rules.

  1. Create a rules directory: By default, Super-Linter looks for configuration files in the .github/linters directory at the root of your repository. You can change this location by setting the LINTER_RULES_PATH environment variable.

  2. Add your configuration file: Place your custom configuration file in the rules directory with the correct name. Super-Linter will automatically detect and use it.

Here are the default filenames Super-Linter looks for:

Linter/Tool Default Filename
Ansible .ansible-lint.yml
ARM Templates .arm-ttk.psd1
Checkov .checkov.yaml
Clang-Format .clang-format
Clojure .clj-kondo/config.edn
CoffeeScript .coffee-lint.json
CSS (Stylelint) .stylelintrc.json
Docker (Hadolint) .hadolint.yaml
EditorConfig .editorconfig-checker.json
Gitleaks .gitleaks.toml
Go .golangci.yml
Groovy .groovylintrc.json
HTML (HTMLHint) .htmlhintrc
Java (Checkstyle) sun_checks.xml
JavaScript (ESLint) eslint.config.mjs
JSCPD .jscpd.json
LaTeX (ChkTex) .chktexrc
Lua (Luacheck) .luacheckrc
Markdown .markdown-lint.yml
OpenAPI (Spectral) .openapirc.yml
PowerShell .powershell-psscriptanalyzer.psd1
Protobuf .protolintrc.yml
Python (Black) .python-black
Python (flake8) .flake8
Python (isort) .isort.cfg
Python (mypy) .mypy.ini
Python (pylint) .python-lint
Python (ruff) .ruff.toml
R .lintr
Ruby (RuboCop) .ruby-lint.yml
Scala (scalafmt) .scalafmt.conf
Snakemake (snakefmt) .snakefmt.toml
SQL (sqlfluff) /.sqlfluff
Terraform (tflint) .tflint.hcl
Terraform (terrascan) terrascan.toml
Textlint .textlintrc
Trivy trivy.yaml
TypeScript (ESLint) eslint.config.mjs
YAML (Yamllint) .yaml-lint.yml

You can find the default templates for these files in the Super-Linter repository.