> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qlty.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Plugins

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](https://github.com/astral-sh/ruff):

```toml plugin.toml for ruff lines theme={"system"}
config_version = "0"

[plugins.definitions.ruff]
runtime = "python"
package = "ruff"
file_types = ["python"]
version_command = "ruff version"
config_files = ["ruff.toml"]
issue_url_format = "https://docs.astral.sh/ruff/rules/${rule}"

[plugins.definitions.ruff.drivers.lint]
script = "ruff check --exit-zero --output-format sarif --output-file ${tmpfile}  ${target}"
success_codes = [0]
output = "tmpfile"
output_format = "sarif"
batch = true
```

Gitleaks supports outputting results in the [SARIF](https://sarifweb.azurewebsites.net/) 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](https://github.com/mvdan/sh) auto-formatter:

```toml plugin.toml for shfmt lines theme={"system"}
config_version = "0"

[plugins.definitions.shfmt]
package = "mvdan.cc/sh/v${major_version}/cmd/shfmt"
runtime = "go"
file_types = ["shell"]
version_command = "shfmt --version"
affects_cache = [".editorconfig"]

[plugins.definitions.shfmt.drivers.format]
script = "shfmt -w -s ${target}"
success_codes = [0, 1]
output = "rewrite"
cache_results = true
batch = true
driver_type = "formatter"
```

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