Qlty integrates with linters, auto-formatters, security scanners, and other static analysis tools as plugins.

Each plugin consists of two components:

  1. A plugin definition in a TOML configuration file
  2. A results parser implemented in Rust

Here is a simplified example plugin definition for Ruff:

plugin.toml for ruff
1config_version = "0"
2
3[plugins.definitions.ruff]
4runtime = "python"
5package = "ruff"
6file_types = ["python"]
7version_command = "ruff version"
8config_files = ["ruff.toml"]
9issue_url_format = "https://docs.astral.sh/ruff/rules/${rule}"
10
11[plugins.definitions.ruff.drivers.lint]
12script = "ruff check --exit-zero --output-format sarif --output-file ${tmpfile} ${target}"
13success_codes = [0]
14output = "tmpfile"
15output_format = "sarif"
16batch = true

Gitleaks supports outputting results in the SARIF standard format, so a custom results parser is not needed. For tools which do not support SARIF, a results parser is implemented within the Qlty CLI and referenced by name.

Auto-Formatters

Auto-formatters are a special type of plugin because they rewrite files rather than outputting findings. Therefore, they do not require results parsers.

Here is an example of a plugin definition for the shfmt auto-formatter:

plugin.toml for shfmt
1config_version = "0"
2
3[plugins.definitions.shfmt]
4package = "mvdan.cc/sh/v${major_version}/cmd/shfmt"
5runtime = "go"
6file_types = ["shell"]
7version_command = "shfmt --version"
8affects_cache = [".editorconfig"]
9
10[plugins.definitions.shfmt.drivers.format]
11script = "shfmt -w -s ${target}"
12success_codes = [0, 1]
13output = "rewrite"
14cache_results = true
15batch = true
16driver_type = "formatter"

Note the specification of output = "rewrite" and driver_type = "formatter".