mirror of https://github.com/astral-sh/ruff
Rename to ruff (#29)
This commit is contained in:
parent
5a5e60dd44
commit
c52fdfa748
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- run: cargo build --bin rust_python_linter --release
|
||||
- run: cargo build --release
|
||||
|
||||
cargo_fmt:
|
||||
name: "cargo fmt"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# Local cache
|
||||
.cache
|
||||
!resources/test/src
|
||||
resources/test
|
||||
resources/test/cpython
|
||||
|
||||
###
|
||||
# Rust.gitignore
|
||||
|
|
|
|||
|
|
@ -1699,7 +1699,7 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-python-linter"
|
||||
name = "ruff"
|
||||
version = "0.0.13"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
[package]
|
||||
name = "rust-python-linter"
|
||||
name = "ruff"
|
||||
version = "0.0.13"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "rust_python_linter"
|
||||
name = "ruff"
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
|||
26
README.md
26
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# rust-python-linter
|
||||
# ruff
|
||||
|
||||
A performance-focused, [Pyflakes](https://github.com/PyCQA/pyflakes)-inspired Python linter, written
|
||||
in Rust.
|
||||
|
|
@ -12,10 +12,10 @@ Features:
|
|||
|
||||
## Installation
|
||||
|
||||
Available as [`rust-python-linter`](https://pypi.org/project/rust-python-linter/) on PyPI:
|
||||
Available as [`ruff`](https://pypi.org/project/ruff/) on PyPI:
|
||||
|
||||
```shell
|
||||
pip install rust-python-linter
|
||||
pip install ruff
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
|
@ -23,22 +23,22 @@ pip install rust-python-linter
|
|||
To run the linter, try any of the following:
|
||||
|
||||
```shell
|
||||
rust_python_linter path/to/code/to/check.py
|
||||
ruff path/to/code/to/check.py
|
||||
# ...or...
|
||||
rust_python_linter path/to/code/
|
||||
ruff path/to/code/
|
||||
# ...or...
|
||||
rust_python_linter path/to/code/*.py
|
||||
ruff path/to/code/*.py
|
||||
```
|
||||
|
||||
You can also run in `--watch` mode to automatically re-run the linter on-change with, e.g.:
|
||||
|
||||
```shell
|
||||
rust_python_linter path/to/code/ --watch
|
||||
ruff path/to/code/ --watch
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
As the name suggests, `rust-python-linter` is implemented in Rust:
|
||||
`ruff` is written in Rust:
|
||||
|
||||
```shell
|
||||
cargo fmt
|
||||
|
|
@ -48,7 +48,7 @@ cargo run resources/test/src
|
|||
|
||||
## Deployment
|
||||
|
||||
`rust-python-linter` is released for Python using [`maturin`](https://github.com/PyO3/maturin):
|
||||
`ruff` is released for Python using [`maturin`](https://github.com/PyO3/maturin):
|
||||
|
||||
```shell
|
||||
maturin publish --skip-existing --target x86_64-apple-darwin
|
||||
|
|
@ -125,14 +125,14 @@ Next, to benchmark the release build:
|
|||
cargo build --release
|
||||
|
||||
hyperfine --warmup 5 \
|
||||
"./target/release/rust_python_linter ./resources/test/cpython/ --no-cache" \
|
||||
"./target/release/rust_python_linter ./resources/test/cpython/"
|
||||
"./target/release/ruff ./resources/test/cpython/ --no-cache" \
|
||||
"./target/release/ruff ./resources/test/cpython/"
|
||||
|
||||
Benchmark 1: ./target/release/rust_python_linter ./resources/test/cpython/ --no-cache
|
||||
Benchmark 1: ./target/release/ruff ./resources/test/cpython/ --no-cache
|
||||
Time (mean ± σ): 353.6 ms ± 7.6 ms [User: 2868.8 ms, System: 171.5 ms]
|
||||
Range (min … max): 344.4 ms … 367.3 ms 10 runs
|
||||
|
||||
Benchmark 2: ./target/release/rust_python_linter ./resources/test/cpython/
|
||||
Benchmark 2: ./target/release/ruff ./resources/test/cpython/
|
||||
Time (mean ± σ): 59.6 ms ± 2.5 ms [User: 36.4 ms, System: 345.6 ms]
|
||||
Range (min … max): 55.9 ms … 67.0 ms 48 runs
|
||||
```
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ use notify::{raw_watcher, RecursiveMode, Watcher};
|
|||
use rayon::prelude::*;
|
||||
use walkdir::DirEntry;
|
||||
|
||||
use ::rust_python_linter::fs::iter_python_files;
|
||||
use ::rust_python_linter::linter::check_path;
|
||||
use ::rust_python_linter::logging::set_up_logging;
|
||||
use ::rust_python_linter::message::Message;
|
||||
use ::rust_python_linter::tell_user;
|
||||
use rust_python_linter::settings::Settings;
|
||||
use ::ruff::fs::iter_python_files;
|
||||
use ::ruff::linter::check_path;
|
||||
use ::ruff::logging::set_up_logging;
|
||||
use ::ruff::message::Message;
|
||||
use ::ruff::settings::Settings;
|
||||
use ::ruff::tell_user;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(name = "rust-python-linter")]
|
||||
#[clap(about = "A bare-bones Python linter written in Rust", long_about = None)]
|
||||
#[clap(name = "ruff")]
|
||||
#[clap(about = "A Python linter written in Rust", long_about = None)]
|
||||
struct Cli {
|
||||
#[clap(parse(from_os_str), value_hint = ValueHint::AnyPath, required = true)]
|
||||
files: Vec<PathBuf>,
|
||||
Loading…
Reference in New Issue