Rename to ruff (#29)

This commit is contained in:
Charlie Marsh 2022-08-27 18:30:30 -04:00 committed by GitHub
parent 5a5e60dd44
commit c52fdfa748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 27 deletions

View File

@ -27,7 +27,7 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build- ${{ runner.os }}-build-
${{ runner.os }}- ${{ runner.os }}-
- run: cargo build --bin rust_python_linter --release - run: cargo build --release
cargo_fmt: cargo_fmt:
name: "cargo fmt" name: "cargo fmt"

3
.gitignore vendored
View File

@ -1,7 +1,6 @@
# Local cache # Local cache
.cache .cache
!resources/test/src resources/test/cpython
resources/test
### ###
# Rust.gitignore # Rust.gitignore

2
Cargo.lock generated
View File

@ -1699,7 +1699,7 @@ dependencies = [
] ]
[[package]] [[package]]
name = "rust-python-linter" name = "ruff"
version = "0.0.13" version = "0.0.13"
dependencies = [ dependencies = [
"anyhow", "anyhow",

View File

@ -1,10 +1,10 @@
[package] [package]
name = "rust-python-linter" name = "ruff"
version = "0.0.13" version = "0.0.13"
edition = "2021" edition = "2021"
[lib] [lib]
name = "rust_python_linter" name = "ruff"
crate-type = ["cdylib", "lib"] crate-type = ["cdylib", "lib"]
[dependencies] [dependencies]

View File

@ -1,4 +1,4 @@
# rust-python-linter # ruff
A performance-focused, [Pyflakes](https://github.com/PyCQA/pyflakes)-inspired Python linter, written A performance-focused, [Pyflakes](https://github.com/PyCQA/pyflakes)-inspired Python linter, written
in Rust. in Rust.
@ -12,10 +12,10 @@ Features:
## Installation ## 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 ```shell
pip install rust-python-linter pip install ruff
``` ```
## Usage ## Usage
@ -23,22 +23,22 @@ pip install rust-python-linter
To run the linter, try any of the following: To run the linter, try any of the following:
```shell ```shell
rust_python_linter path/to/code/to/check.py ruff path/to/code/to/check.py
# ...or... # ...or...
rust_python_linter path/to/code/ ruff path/to/code/
# ...or... # ...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.: You can also run in `--watch` mode to automatically re-run the linter on-change with, e.g.:
```shell ```shell
rust_python_linter path/to/code/ --watch ruff path/to/code/ --watch
``` ```
## Development ## Development
As the name suggests, `rust-python-linter` is implemented in Rust: `ruff` is written in Rust:
```shell ```shell
cargo fmt cargo fmt
@ -48,7 +48,7 @@ cargo run resources/test/src
## Deployment ## 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 ```shell
maturin publish --skip-existing --target x86_64-apple-darwin maturin publish --skip-existing --target x86_64-apple-darwin
@ -125,14 +125,14 @@ Next, to benchmark the release build:
cargo build --release cargo build --release
hyperfine --warmup 5 \ hyperfine --warmup 5 \
"./target/release/rust_python_linter ./resources/test/cpython/ --no-cache" \ "./target/release/ruff ./resources/test/cpython/ --no-cache" \
"./target/release/rust_python_linter ./resources/test/cpython/" "./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] 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 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] 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 Range (min … max): 55.9 ms … 67.0 ms 48 runs
``` ```

View File

@ -11,16 +11,16 @@ use notify::{raw_watcher, RecursiveMode, Watcher};
use rayon::prelude::*; use rayon::prelude::*;
use walkdir::DirEntry; use walkdir::DirEntry;
use ::rust_python_linter::fs::iter_python_files; use ::ruff::fs::iter_python_files;
use ::rust_python_linter::linter::check_path; use ::ruff::linter::check_path;
use ::rust_python_linter::logging::set_up_logging; use ::ruff::logging::set_up_logging;
use ::rust_python_linter::message::Message; use ::ruff::message::Message;
use ::rust_python_linter::tell_user; use ::ruff::settings::Settings;
use rust_python_linter::settings::Settings; use ::ruff::tell_user;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[clap(name = "rust-python-linter")] #[clap(name = "ruff")]
#[clap(about = "A bare-bones Python linter written in Rust", long_about = None)] #[clap(about = "A Python linter written in Rust", long_about = None)]
struct Cli { struct Cli {
#[clap(parse(from_os_str), value_hint = ValueHint::AnyPath, required = true)] #[clap(parse(from_os_str), value_hint = ValueHint::AnyPath, required = true)]
files: Vec<PathBuf>, files: Vec<PathBuf>,