Giter Site home page Giter Site logo

justinchuby / lintrunner-adapters Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 2.0 238 KB

Adapters and tools for lintrunner

Home Page: https://pypi.org/project/lintrunner-adapters

License: Other

Python 100.00%
ci linting sarif lintrunner code-scanning clippy flake8 lint linter python

lintrunner-adapters's Introduction

lintrunner-adapters

CI PyPI version

Adapters and tools for 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. Contribution is welcome!

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

Install

pip install lintrunner-adapters

Usage

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 config file in this repo and example configs for each adapter under 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 as an example.

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

Option 1

Use a GitHub Action: lintrunner-action

Option 2

Run it directly in the workflow. See .github/workflows/ci.yml.

lintrunner-adapters's People

Contributors

dependabot[bot] avatar justinchuby avatar q0w avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

q0w derrickkbrend

lintrunner-adapters's Issues

Ruff has no options as `--format`

Hi,

I'm always getting error like

STDERR
    error: unexpected argument '--format' found

I'm using latest Ruff version 0.1.6. Seems they have removed --format option:

Ruff: An extremely fast Python linter.

Usage: ruff [OPTIONS] <COMMAND>

Commands:
  check    Run Ruff on the given files or directories (default)
  rule     Explain a rule (or all rules)
  config   List or describe the available configuration options
  linter   List all supported upstream linters
  clean    Clear any caches in the current directory and any subdirectories
  format   Run the Ruff formatter on the given files or directories
  version  Display Ruff's version
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Log levels:
  -v, --verbose  Enable verbose logging
  -q, --quiet    Print diagnostics, but nothing else
  -s, --silent   Disable all logging (but still exit with status code "1" upon detecting diagnostics)

For help with a specific command, see: `ruff help <command>`.

Can you please remove --format from
https://github.com/justinchuby/lintrunner-adapters/blob/main/lintrunner_adapters/adapters/ruff_linter.py#L89 ?

Thanks!

BLACK-ISORT linter fails on Windows when black==24.1.1 and Python==3.9

This linter processes the file with isort before sending the result to black as input to the subprocess.

In

proc = run_command(
[
sys.executable,
"-mblack",
*(("--pyi",) if filename.endswith(".pyi") else ()),
*(("--ipynb",) if filename.endswith(".ipynb") else ()),
*(("--fast",) if fast else ()),
"--stdin-filename",
filename,
"-",
],
stdin=None,
input=import_sorted,
retries=retries,
timeout=timeout,
check=True,
)
, the input argument was somehow not taken by black when black==24.1.1 on Windows, Python 3.8/Python 3.9.

Maybe consider pipeline the results instead and send it via stdin?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.