mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:25:17 +00:00
Rename ruff_cli
crate to ruff
(#9557)
## Summary Long ago, we had a single `ruff` crate. We started to break that up, and at some point, we wanted to separate the CLI from the core library. So we created `ruff_cli`, which created a `ruff` binary. Later, the `ruff` crate was renamed to `ruff_linter` and further broken up into additional crates. (This is all from memory -- I didn't bother to look through the history to ensure that this is 100% correct :)) Now that `ruff` no longer exists, this PR renames `ruff_cli` to `ruff`. The primary benefit is that the binary target and the crate name are now the same, which helps with downstream tooling like `cargo-dist`, and also removes some complexity from the crate and `Cargo.toml` itself. ## Test Plan - Ran `rm -rf target/release`. - Ran `cargo build --release`. - Verified that `./target/release/ruff` was created.
This commit is contained in:
parent
45d374d838
commit
8118d29419
64 changed files with 84 additions and 87 deletions
|
@ -4,7 +4,7 @@ exclude: |
|
||||||
(?x)^(
|
(?x)^(
|
||||||
crates/ruff_linter/resources/.*|
|
crates/ruff_linter/resources/.*|
|
||||||
crates/ruff_linter/src/rules/.*/snapshots/.*|
|
crates/ruff_linter/src/rules/.*/snapshots/.*|
|
||||||
crates/ruff_cli/resources/.*|
|
crates/ruff/resources/.*|
|
||||||
crates/ruff_python_formatter/resources/.*|
|
crates/ruff_python_formatter/resources/.*|
|
||||||
crates/ruff_python_formatter/tests/snapshots/.*|
|
crates/ruff_python_formatter/tests/snapshots/.*|
|
||||||
crates/ruff_python_resolver/resources/.*|
|
crates/ruff_python_resolver/resources/.*|
|
||||||
|
|
|
@ -81,7 +81,7 @@ pre-commit install
|
||||||
After cloning the repository, run Ruff locally from the repository root with:
|
After cloning the repository, run Ruff locally from the repository root with:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cargo run -p ruff_cli -- check /path/to/file.py --no-cache
|
cargo run -p ruff -- check /path/to/file.py --no-cache
|
||||||
```
|
```
|
||||||
|
|
||||||
Prior to opening a pull request, ensure that your code has been auto-formatted,
|
Prior to opening a pull request, ensure that your code has been auto-formatted,
|
||||||
|
@ -120,7 +120,7 @@ At the time of writing, the repository includes the following crates:
|
||||||
If you're working on a rule, this is the crate for you.
|
If you're working on a rule, this is the crate for you.
|
||||||
- `crates/ruff_benchmark`: binary crate for running micro-benchmarks.
|
- `crates/ruff_benchmark`: binary crate for running micro-benchmarks.
|
||||||
- `crates/ruff_cache`: library crate for caching lint results.
|
- `crates/ruff_cache`: library crate for caching lint results.
|
||||||
- `crates/ruff_cli`: binary crate containing Ruff's command-line interface.
|
- `crates/ruff`: binary crate containing Ruff's command-line interface.
|
||||||
- `crates/ruff_dev`: binary crate containing utilities used in the development of Ruff itself (e.g.,
|
- `crates/ruff_dev`: binary crate containing utilities used in the development of Ruff itself (e.g.,
|
||||||
`cargo dev generate-all`), see the [`cargo dev`](#cargo-dev) section below.
|
`cargo dev generate-all`), see the [`cargo dev`](#cargo-dev) section below.
|
||||||
- `crates/ruff_diagnostics`: library crate for the rule-independent abstractions in the lint
|
- `crates/ruff_diagnostics`: library crate for the rule-independent abstractions in the lint
|
||||||
|
@ -231,7 +231,7 @@ Once you've completed the code for the rule itself, you can define tests with th
|
||||||
For example, if you're adding a new rule named `E402`, you would run:
|
For example, if you're adding a new rule named `E402`, you would run:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cargo run -p ruff_cli -- check crates/ruff_linter/resources/test/fixtures/pycodestyle/E402.py --no-cache --select E402
|
cargo run -p ruff -- check crates/ruff_linter/resources/test/fixtures/pycodestyle/E402.py --no-cache --select E402
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** Only a subset of rules are enabled by default. When testing a new rule, ensure that
|
**Note:** Only a subset of rules are enabled by default. When testing a new rule, ensure that
|
||||||
|
@ -252,7 +252,7 @@ Once you've completed the code for the rule itself, you can define tests with th
|
||||||
|
|
||||||
Ruff's user-facing settings live in a few different places.
|
Ruff's user-facing settings live in a few different places.
|
||||||
|
|
||||||
First, the command-line options are defined via the `Args` struct in `crates/ruff_cli/src/args.rs`.
|
First, the command-line options are defined via the `Args` struct in `crates/ruff/src/args.rs`.
|
||||||
|
|
||||||
Second, the `pyproject.toml` options are defined in `crates/ruff_workspace/src/options.rs` (via the
|
Second, the `pyproject.toml` options are defined in `crates/ruff_workspace/src/options.rs` (via the
|
||||||
`Options` struct), `crates/ruff_workspace/src/configuration.rs` (via the `Configuration` struct),
|
`Options` struct), `crates/ruff_workspace/src/configuration.rs` (via the `Configuration` struct),
|
||||||
|
|
70
Cargo.lock
generated
70
Cargo.lock
generated
|
@ -2003,40 +2003,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruff_benchmark"
|
name = "ruff"
|
||||||
version = "0.0.0"
|
|
||||||
dependencies = [
|
|
||||||
"codspeed-criterion-compat",
|
|
||||||
"criterion",
|
|
||||||
"mimalloc",
|
|
||||||
"once_cell",
|
|
||||||
"ruff_linter",
|
|
||||||
"ruff_python_ast",
|
|
||||||
"ruff_python_formatter",
|
|
||||||
"ruff_python_index",
|
|
||||||
"ruff_python_parser",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"tikv-jemallocator",
|
|
||||||
"ureq",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ruff_cache"
|
|
||||||
version = "0.0.0"
|
|
||||||
dependencies = [
|
|
||||||
"filetime",
|
|
||||||
"glob",
|
|
||||||
"globset",
|
|
||||||
"itertools 0.12.0",
|
|
||||||
"regex",
|
|
||||||
"ruff_macros",
|
|
||||||
"seahash",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ruff_cli"
|
|
||||||
version = "0.1.13"
|
version = "0.1.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
@ -2086,6 +2053,39 @@ dependencies = [
|
||||||
"wild",
|
"wild",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ruff_benchmark"
|
||||||
|
version = "0.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"codspeed-criterion-compat",
|
||||||
|
"criterion",
|
||||||
|
"mimalloc",
|
||||||
|
"once_cell",
|
||||||
|
"ruff_linter",
|
||||||
|
"ruff_python_ast",
|
||||||
|
"ruff_python_formatter",
|
||||||
|
"ruff_python_index",
|
||||||
|
"ruff_python_parser",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tikv-jemallocator",
|
||||||
|
"ureq",
|
||||||
|
"url",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ruff_cache"
|
||||||
|
version = "0.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"filetime",
|
||||||
|
"glob",
|
||||||
|
"globset",
|
||||||
|
"itertools 0.12.0",
|
||||||
|
"regex",
|
||||||
|
"ruff_macros",
|
||||||
|
"seahash",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruff_dev"
|
name = "ruff_dev"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
@ -2102,7 +2102,7 @@ dependencies = [
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
"rayon",
|
"rayon",
|
||||||
"regex",
|
"regex",
|
||||||
"ruff_cli",
|
"ruff",
|
||||||
"ruff_diagnostics",
|
"ruff_diagnostics",
|
||||||
"ruff_formatter",
|
"ruff_formatter",
|
||||||
"ruff_linter",
|
"ruff_linter",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ruff_cli"
|
name = "ruff"
|
||||||
version = "0.1.13"
|
version = "0.1.13"
|
||||||
publish = false
|
publish = false
|
||||||
authors = { workspace = true }
|
authors = { workspace = true }
|
||||||
|
@ -11,9 +11,6 @@ repository = { workspace = true }
|
||||||
license = { workspace = true }
|
license = { workspace = true }
|
||||||
readme = "../../README.md"
|
readme = "../../README.md"
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "ruff"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ruff_cache = { path = "../ruff_cache" }
|
ruff_cache = { path = "../ruff_cache" }
|
||||||
ruff_diagnostics = { path = "../ruff_diagnostics" }
|
ruff_diagnostics = { path = "../ruff_diagnostics" }
|
|
@ -83,7 +83,7 @@ pub enum Command {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// The `Parser` derive is for ruff_dev, for ruff_cli `Args` would be sufficient
|
// The `Parser` derive is for ruff_dev, for ruff `Args` would be sufficient
|
||||||
#[derive(Clone, Debug, clap::Parser)]
|
#[derive(Clone, Debug, clap::Parser)]
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
pub struct CheckCommand {
|
pub struct CheckCommand {
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_cli/src/commands/check.rs
|
source: crates/ruff/src/commands/check.rs
|
||||||
---
|
---
|
||||||
/home/ferris/project/code.py:1:1: E902 Permission denied (os error 13)
|
/home/ferris/project/code.py:1:1: E902 Permission denied (os error 13)
|
||||||
/home/ferris/project/notebook.ipynb:1:1: E902 Permission denied (os error 13)
|
/home/ferris/project/notebook.ipynb:1:1: E902 Permission denied (os error 13)
|
|
@ -3,8 +3,8 @@ use std::process::ExitCode;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
|
||||||
use ruff_cli::args::{Args, Command};
|
use ruff::args::{Args, Command};
|
||||||
use ruff_cli::{run, ExitStatus};
|
use ruff::{run, ExitStatus};
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
#[global_allocator]
|
#[global_allocator]
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff/src/version.rs
|
||||||
|
expression: version
|
||||||
|
---
|
||||||
|
0.0.0
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_cli/src/version.rs
|
source: crates/ruff/src/version.rs
|
||||||
expression: version
|
expression: version
|
||||||
---
|
---
|
||||||
0.0.0 (53b0f5d92 2023-10-19)
|
0.0.0 (53b0f5d92 2023-10-19)
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_cli/src/version.rs
|
source: crates/ruff/src/version.rs
|
||||||
expression: version
|
expression: version
|
||||||
---
|
---
|
||||||
0.0.0+24 (53b0f5d92 2023-10-19)
|
0.0.0+24 (53b0f5d92 2023-10-19)
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_cli/src/version.rs
|
source: crates/ruff/src/version.rs
|
||||||
expression: version
|
expression: version
|
||||||
---
|
---
|
||||||
{
|
{
|
|
@ -20,9 +20,9 @@ use path_absolutize::path_dedot;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use ruff_cli::args::Args;
|
use ruff::args::Args;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use ruff_cli::run;
|
use ruff::run;
|
||||||
|
|
||||||
const BIN_NAME: &str = "ruff";
|
const BIN_NAME: &str = "ruff";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_cli/tests/integration_test.rs
|
source: crates/ruff/tests/integration_test.rs
|
||||||
info:
|
info:
|
||||||
program: ruff
|
program: ruff
|
||||||
args:
|
args:
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_cli/tests/integration_test.rs
|
source: crates/ruff/tests/integration_test.rs
|
||||||
info:
|
info:
|
||||||
program: ruff
|
program: ruff
|
||||||
args:
|
args:
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_cli/tests/show_settings.rs
|
source: crates/ruff/tests/show_settings.rs
|
||||||
info:
|
info:
|
||||||
program: ruff
|
program: ruff
|
||||||
args:
|
args:
|
||||||
|
@ -10,7 +10,7 @@ info:
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
Resolved settings for: "[BASEPATH]/crates/ruff_cli/resources/test/fixtures/unformatted.py"
|
Resolved settings for: "[BASEPATH]/crates/ruff/resources/test/fixtures/unformatted.py"
|
||||||
Settings path: "[BASEPATH]/pyproject.toml"
|
Settings path: "[BASEPATH]/pyproject.toml"
|
||||||
|
|
||||||
# General Settings
|
# General Settings
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff_cli/src/version.rs
|
|
||||||
expression: version
|
|
||||||
---
|
|
||||||
0.0.0
|
|
|
@ -11,14 +11,14 @@ repository = { workspace = true }
|
||||||
license = { workspace = true }
|
license = { workspace = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ruff_linter = { path = "../ruff_linter", features = ["schemars"] }
|
ruff = { path = "../ruff" }
|
||||||
ruff_cli = { path = "../ruff_cli" }
|
|
||||||
ruff_diagnostics = { path = "../ruff_diagnostics" }
|
ruff_diagnostics = { path = "../ruff_diagnostics" }
|
||||||
ruff_formatter = { path = "../ruff_formatter" }
|
ruff_formatter = { path = "../ruff_formatter" }
|
||||||
|
ruff_linter = { path = "../ruff_linter", features = ["schemars"] }
|
||||||
|
ruff_notebook = { path = "../ruff_notebook" }
|
||||||
ruff_python_ast = { path = "../ruff_python_ast" }
|
ruff_python_ast = { path = "../ruff_python_ast" }
|
||||||
ruff_python_codegen = { path = "../ruff_python_codegen" }
|
ruff_python_codegen = { path = "../ruff_python_codegen" }
|
||||||
ruff_python_formatter = { path = "../ruff_python_formatter" }
|
ruff_python_formatter = { path = "../ruff_python_formatter" }
|
||||||
ruff_notebook = { path = "../ruff_notebook" }
|
|
||||||
ruff_python_parser = { path = "../ruff_python_parser" }
|
ruff_python_parser = { path = "../ruff_python_parser" }
|
||||||
ruff_python_stdlib = { path = "../ruff_python_stdlib" }
|
ruff_python_stdlib = { path = "../ruff_python_stdlib" }
|
||||||
ruff_python_trivia = { path = "../ruff_python_trivia" }
|
ruff_python_trivia = { path = "../ruff_python_trivia" }
|
||||||
|
|
|
@ -27,8 +27,8 @@ use tracing_subscriber::layer::SubscriberExt;
|
||||||
use tracing_subscriber::util::SubscriberInitExt;
|
use tracing_subscriber::util::SubscriberInitExt;
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
use ruff_cli::args::{CliOverrides, FormatArguments, FormatCommand, LogLevelArgs};
|
use ruff::args::{CliOverrides, FormatArguments, FormatCommand, LogLevelArgs};
|
||||||
use ruff_cli::resolve::resolve;
|
use ruff::resolve::resolve;
|
||||||
use ruff_formatter::{FormatError, LineWidth, PrintError};
|
use ruff_formatter::{FormatError, LineWidth, PrintError};
|
||||||
use ruff_linter::logging::LogLevel;
|
use ruff_linter::logging::LogLevel;
|
||||||
use ruff_linter::settings::types::{FilePattern, FilePatternSet};
|
use ruff_linter::settings::types::{FilePattern, FilePatternSet};
|
||||||
|
@ -67,7 +67,7 @@ fn find_pyproject_config(
|
||||||
Ok(pyproject_config)
|
Ok(pyproject_config)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find files that ruff would check so we can format them. Adapted from `ruff_cli`.
|
/// Find files that ruff would check so we can format them. Adapted from `ruff`.
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
fn ruff_check_paths<'a>(
|
fn ruff_check_paths<'a>(
|
||||||
pyproject_config: &'a PyprojectConfig,
|
pyproject_config: &'a PyprojectConfig,
|
||||||
|
@ -287,7 +287,7 @@ fn setup_logging(log_level_args: &LogLevelArgs, log_file: Option<&Path>) -> io::
|
||||||
LogLevel::Quiet => tracing::Level::WARN,
|
LogLevel::Quiet => tracing::Level::WARN,
|
||||||
LogLevel::Silent => tracing::Level::ERROR,
|
LogLevel::Silent => tracing::Level::ERROR,
|
||||||
};
|
};
|
||||||
// 1. `RUST_LOG=`, 2. explicit CLI log level, 3. info, the ruff_cli default
|
// 1. `RUST_LOG=`, 2. explicit CLI log level, 3. info, the ruff default
|
||||||
let filter_layer = EnvFilter::try_from_default_env().unwrap_or_else(|_| {
|
let filter_layer = EnvFilter::try_from_default_env().unwrap_or_else(|_| {
|
||||||
EnvFilter::builder()
|
EnvFilter::builder()
|
||||||
.with_default_directive(log_level.into())
|
.with_default_directive(log_level.into())
|
||||||
|
@ -461,7 +461,7 @@ fn format_dev_project(
|
||||||
|
|
||||||
// TODO(konstin): Respect black's excludes.
|
// TODO(konstin): Respect black's excludes.
|
||||||
|
|
||||||
// Find files to check (or in this case, format twice). Adapted from ruff_cli
|
// Find files to check (or in this case, format twice). Adapted from ruff
|
||||||
// First argument is ignored
|
// First argument is ignored
|
||||||
let (cli, overrides) = parse_cli(files)?;
|
let (cli, overrides) = parse_cli(files)?;
|
||||||
let pyproject_config = find_pyproject_config(&cli, &overrides)?;
|
let pyproject_config = find_pyproject_config(&cli, &overrides)?;
|
||||||
|
|
|
@ -8,7 +8,7 @@ use anyhow::{bail, Context, Result};
|
||||||
use clap::CommandFactory;
|
use clap::CommandFactory;
|
||||||
use pretty_assertions::StrComparison;
|
use pretty_assertions::StrComparison;
|
||||||
|
|
||||||
use ruff_cli::args;
|
use ruff::args;
|
||||||
|
|
||||||
use crate::generate_all::{Mode, REGENERATE_ALL_COMMAND};
|
use crate::generate_all::{Mode, REGENERATE_ALL_COMMAND};
|
||||||
use crate::ROOT_DIR;
|
use crate::ROOT_DIR;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use ruff_cli::check;
|
use ruff::check;
|
||||||
use ruff_linter::logging::{set_up_logging, LogLevel};
|
use ruff_linter::logging::{set_up_logging, LogLevel};
|
||||||
use std::process::ExitCode;
|
use std::process::ExitCode;
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ enum Command {
|
||||||
/// Run a ruff command n times for profiling/benchmarking
|
/// Run a ruff command n times for profiling/benchmarking
|
||||||
Repeat {
|
Repeat {
|
||||||
#[clap(flatten)]
|
#[clap(flatten)]
|
||||||
args: ruff_cli::args::CheckCommand,
|
args: ruff::args::CheckCommand,
|
||||||
#[clap(flatten)]
|
#[clap(flatten)]
|
||||||
log_level_args: ruff_cli::args::LogLevelArgs,
|
log_level_args: ruff::args::LogLevelArgs,
|
||||||
/// Run this many times
|
/// Run this many times
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
repeat: usize,
|
repeat: usize,
|
||||||
|
|
|
@ -8,7 +8,7 @@ behaviors.
|
||||||
Running from the repo root should pick up and enforce the appropriate settings for each package:
|
Running from the repo root should pick up and enforce the appropriate settings for each package:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
∴ cargo run -p ruff_cli -- check crates/ruff_linter/resources/test/project/
|
∴ cargo run -p ruff -- check crates/ruff_linter/resources/test/project/
|
||||||
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||||
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
||||||
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
||||||
|
@ -23,7 +23,7 @@ Found 7 errors.
|
||||||
Running from the project directory itself should exhibit the same behavior:
|
Running from the project directory itself should exhibit the same behavior:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
∴ (cd crates/ruff_linter/resources/test/project/ && cargo run -p ruff_cli -- check .)
|
∴ (cd crates/ruff_linter/resources/test/project/ && cargo run -p ruff -- check .)
|
||||||
examples/.dotfiles/script.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
examples/.dotfiles/script.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||||
examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
||||||
examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
||||||
|
@ -39,7 +39,7 @@ Running from the sub-package directory should exhibit the same behavior, but omi
|
||||||
files:
|
files:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
∴ (cd crates/ruff_linter/resources/test/project/examples/docs && cargo run -p ruff_cli -- check .)
|
∴ (cd crates/ruff_linter/resources/test/project/examples/docs && cargo run -p ruff -- check .)
|
||||||
docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||||
docs/file.py:8:5: F841 [*] Local variable `x` is assigned to but never used
|
docs/file.py:8:5: F841 [*] Local variable `x` is assigned to but never used
|
||||||
Found 2 errors.
|
Found 2 errors.
|
||||||
|
@ -50,7 +50,7 @@ Found 2 errors.
|
||||||
file paths from the current working directory:
|
file paths from the current working directory:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
∴ (cargo run -p ruff_cli -- check --config=crates/ruff_linter/resources/test/project/pyproject.toml crates/ruff_linter/resources/test/project/)
|
∴ (cargo run -p ruff -- check --config=crates/ruff_linter/resources/test/project/pyproject.toml crates/ruff_linter/resources/test/project/)
|
||||||
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
||||||
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
crates/ruff_linter/resources/test/project/examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
||||||
crates/ruff_linter/resources/test/project/examples/docs/docs/concepts/file.py:1:8: F401 [*] `os` imported but unused
|
crates/ruff_linter/resources/test/project/examples/docs/docs/concepts/file.py:1:8: F401 [*] `os` imported but unused
|
||||||
|
@ -68,7 +68,7 @@ Running from a parent directory should "ignore" the `exclude` (hence, `concepts/
|
||||||
included in the output):
|
included in the output):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
∴ (cd crates/ruff_linter/resources/test/project/examples && cargo run -p ruff_cli -- check --config=docs/ruff.toml .)
|
∴ (cd crates/ruff_linter/resources/test/project/examples && cargo run -p ruff -- check --config=docs/ruff.toml .)
|
||||||
docs/docs/concepts/file.py:5:5: F841 [*] Local variable `x` is assigned to but never used
|
docs/docs/concepts/file.py:5:5: F841 [*] Local variable `x` is assigned to but never used
|
||||||
docs/docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
docs/docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||||
docs/docs/file.py:8:5: F841 [*] Local variable `x` is assigned to but never used
|
docs/docs/file.py:8:5: F841 [*] Local variable `x` is assigned to but never used
|
||||||
|
@ -80,7 +80,7 @@ Found 4 errors.
|
||||||
Passing an excluded directory directly should report errors in the contained files:
|
Passing an excluded directory directly should report errors in the contained files:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
∴ cargo run -p ruff_cli -- check crates/ruff_linter/resources/test/project/examples/excluded/
|
∴ cargo run -p ruff -- check crates/ruff_linter/resources/test/project/examples/excluded/
|
||||||
crates/ruff_linter/resources/test/project/examples/excluded/script.py:1:8: F401 [*] `os` imported but unused
|
crates/ruff_linter/resources/test/project/examples/excluded/script.py:1:8: F401 [*] `os` imported but unused
|
||||||
Found 1 error.
|
Found 1 error.
|
||||||
[*] 1 potentially fixable with the --fix option.
|
[*] 1 potentially fixable with the --fix option.
|
||||||
|
@ -89,8 +89,8 @@ Found 1 error.
|
||||||
Unless we `--force-exclude`:
|
Unless we `--force-exclude`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
∴ cargo run -p ruff_cli -- check crates/ruff_linter/resources/test/project/examples/excluded/ --force-exclude
|
∴ cargo run -p ruff -- check crates/ruff_linter/resources/test/project/examples/excluded/ --force-exclude
|
||||||
warning: No Python files found under the given path(s)
|
warning: No Python files found under the given path(s)
|
||||||
∴ cargo run -p ruff_cli -- check crates/ruff_linter/resources/test/project/examples/excluded/script.py --force-exclude
|
∴ cargo run -p ruff -- check crates/ruff_linter/resources/test/project/examples/excluded/script.py --force-exclude
|
||||||
warning: No Python files found under the given path(s)
|
warning: No Python files found under the given path(s)
|
||||||
```
|
```
|
||||||
|
|
|
@ -108,7 +108,7 @@ pub(crate) fn is_single_rule_selector(prefix: &RuleCodePrefix) -> bool {
|
||||||
pub enum ParseError {
|
pub enum ParseError {
|
||||||
#[error("Unknown rule selector: `{0}`")]
|
#[error("Unknown rule selector: `{0}`")]
|
||||||
// TODO(martin): tell the user how to discover rule codes via the CLI once such a command is
|
// TODO(martin): tell the user how to discover rule codes via the CLI once such a command is
|
||||||
// implemented (but that should of course be done only in ruff_cli and not here)
|
// implemented (but that should of course be done only in ruff and not here)
|
||||||
Unknown(String),
|
Unknown(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -895,7 +895,7 @@ impl LintConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (from, target) in redirects {
|
for (from, target) in redirects {
|
||||||
// TODO(martin): This belongs into the ruff_cli crate.
|
// TODO(martin): This belongs into the ruff crate.
|
||||||
warn_user_once_by_id!(
|
warn_user_once_by_id!(
|
||||||
from,
|
from,
|
||||||
"`{from}` has been remapped to `{}{}`.",
|
"`{from}` has been remapped to `{}{}`.",
|
||||||
|
|
|
@ -44,7 +44,7 @@ Changelog = "https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md"
|
||||||
|
|
||||||
[tool.maturin]
|
[tool.maturin]
|
||||||
bindings = "bin"
|
bindings = "bin"
|
||||||
manifest-path = "crates/ruff_cli/Cargo.toml"
|
manifest-path = "crates/ruff/Cargo.toml"
|
||||||
module-name = "ruff"
|
module-name = "ruff"
|
||||||
python-source = "python"
|
python-source = "python"
|
||||||
strip = true
|
strip = true
|
||||||
|
@ -93,7 +93,7 @@ changelog_contributors = false
|
||||||
version_files = [
|
version_files = [
|
||||||
"README.md",
|
"README.md",
|
||||||
"docs/integrations.md",
|
"docs/integrations.md",
|
||||||
"crates/ruff_cli/Cargo.toml",
|
"crates/ruff/Cargo.toml",
|
||||||
"crates/ruff_linter/Cargo.toml",
|
"crates/ruff_linter/Cargo.toml",
|
||||||
"crates/ruff_shrinking/Cargo.toml",
|
"crates/ruff_shrinking/Cargo.toml",
|
||||||
"scripts/benchmarks/pyproject.toml",
|
"scripts/benchmarks/pyproject.toml",
|
||||||
|
|
|
@ -149,7 +149,7 @@ def main() -> None:
|
||||||
"cargo",
|
"cargo",
|
||||||
"run",
|
"run",
|
||||||
"-p",
|
"-p",
|
||||||
"ruff_cli",
|
"ruff",
|
||||||
"--",
|
"--",
|
||||||
"rule",
|
"rule",
|
||||||
"--all",
|
"--all",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue