Metadata-Version: 2.4
Name: lintrunner-adapters
Version: 0.14.0
Summary: Adapters and tools for lintrunner
Author-email: Justin Chu <justinchu@microsoft.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/justinchuby/lintrunner-adapters
Keywords: lintrunner,lint,cli,sarif,linting,ci,linter,flake8,clippy,ruff,rustfmt,github-code-scanning
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.3
Provides-Extra: dev
Requires-Dist: lintrunner>=0.10.0; extra == "dev"
Requires-Dist: pytest>=7.2.0; extra == "dev"
Requires-Dist: types-pyyaml>=6.0.12.2; extra == "dev"
Dynamic: license-file

# lintrunner-adapters

[![CI](https://github.com/justinchuby/lintrunner-adapters/actions/workflows/ci.yml/badge.svg)](https://github.com/justinchuby/lintrunner-adapters/actions/workflows/ci.yml)
[![PyPI - Version](https://img.shields.io/pypi/v/lintrunner-adapters)](https://pypi.org/project/lintrunner-adapters)
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/lintrunner-adapters?period=monthly&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads+%2F+month)](https://pepy.tech/projects/lintrunner-adapters)

Adapters and tools for [lintrunner](https://github.com/suo/lintrunner).

`lintrunner-adapters` currently supports popular Python / Rust / C++ linters and formatters like `flake8`, `pylint`, `mypy`, `black`, `ruff`(with auto-fix support), `rustfmt`, `clippy`, `clang-format` and many more - and the list is growing. Contributions welcome!

To see the list of supported linters and formatters, run `lintrunner_adapters run`.

## Install

```sh
pip install lintrunner-adapters
```

## Usage

```text
Usage: python -m lintrunner_adapters [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  run       Run an adapter.
  to-sarif  Convert the output of lintrunner json (INPUT) to SARIF (OUTPUT).
```

Use `lintrunner_adapters run` to see a list of adapters available.

## GitHub action

https://github.com/justinchuby/lintrunner-action

## How to

### Use `lintrunner_adapters` with `lintrunner` in your project

Refer to the [`.lintrunner.toml`](https://github.com/justinchuby/lintrunner-adapters/blob/main/.lintrunner.toml) config file in this repo and example configs for each adapter under [`examples/adapters`](https://github.com/justinchuby/lintrunner-adapters/tree/main/examples/adapters).

### Write lint config in `.lintrunner.toml`

See https://docs.rs/lintrunner/latest/lintrunner/lint_config/struct.LintConfig.html.

### Create a new adapter

Use [`lintrunner_adapters/adapters/pylint_linter.py`](https://github.com/justinchuby/lintrunner-adapters/blob/main/lintrunner_adapters/adapters/pylint_linter.py) as an example.

### Run lintrunner in CI and get Github code scanning messages in your PRs

#### Option 1

Use a GitHub Action: [lintrunner-action](https://github.com/justinchuby/lintrunner-action)

#### Option 2

Run it directly in the workflow. See [`.github/workflows/ci.yml`](https://github.com/justinchuby/lintrunner-adapters/blob/main/.github/workflows/ci.yml).
