Skip to content

Commit 8118d29

Browse files
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.
1 parent 45d374d commit 8118d29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+84
-87
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exclude: |
44
(?x)^(
55
crates/ruff_linter/resources/.*|
66
crates/ruff_linter/src/rules/.*/snapshots/.*|
7-
crates/ruff_cli/resources/.*|
7+
crates/ruff/resources/.*|
88
crates/ruff_python_formatter/resources/.*|
99
crates/ruff_python_formatter/tests/snapshots/.*|
1010
crates/ruff_python_resolver/resources/.*|

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions

Cargo.lock

Lines changed: 35 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ruff_cli/Cargo.toml renamed to crates/ruff/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "ruff_cli"
2+
name = "ruff"
33
version = "0.1.13"
44
publish = false
55
authors = { workspace = true }
@@ -11,9 +11,6 @@ repository = { workspace = true }
1111
license = { workspace = true }
1212
readme = "../../README.md"
1313

14-
[[bin]]
15-
name = "ruff"
16-
1714
[dependencies]
1815
ruff_cache = { path = "../ruff_cache" }
1916
ruff_diagnostics = { path = "../ruff_diagnostics" }
File renamed without changes.

crates/ruff_cli/src/args.rs renamed to crates/ruff/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub enum Command {
8383
},
8484
}
8585

86-
// The `Parser` derive is for ruff_dev, for ruff_cli `Args` would be sufficient
86+
// The `Parser` derive is for ruff_dev, for ruff `Args` would be sufficient
8787
#[derive(Clone, Debug, clap::Parser)]
8888
#[allow(clippy::struct_excessive_bools)]
8989
pub struct CheckCommand {
File renamed without changes.
File renamed without changes.

crates/ruff_cli/src/commands/snapshots/ruff_cli__commands__check__test__E902_E902.py.snap renamed to crates/ruff/src/commands/snapshots/ruff__commands__check__test__E902_E902.py.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: crates/ruff_cli/src/commands/check.rs
2+
source: crates/ruff/src/commands/check.rs
33
---
44
/home/ferris/project/code.py:1:1: E902 Permission denied (os error 13)
55
/home/ferris/project/notebook.ipynb:1:1: E902 Permission denied (os error 13)
File renamed without changes.
File renamed without changes.

crates/ruff_cli/src/bin/ruff.rs renamed to crates/ruff/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::process::ExitCode;
33
use clap::{Parser, Subcommand};
44
use colored::Colorize;
55

6-
use ruff_cli::args::{Args, Command};
7-
use ruff_cli::{run, ExitStatus};
6+
use ruff::args::{Args, Command};
7+
use ruff::{run, ExitStatus};
88

99
#[cfg(target_os = "windows")]
1010
#[global_allocator]
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
source: crates/ruff/src/version.rs
3+
expression: version
4+
---
5+
0.0.0
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: crates/ruff_cli/src/version.rs
2+
source: crates/ruff/src/version.rs
33
expression: version
44
---
55
0.0.0 (53b0f5d92 2023-10-19)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: crates/ruff_cli/src/version.rs
2+
source: crates/ruff/src/version.rs
33
expression: version
44
---
55
0.0.0+24 (53b0f5d92 2023-10-19)

crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_serializable.snap renamed to crates/ruff/src/snapshots/ruff__version__tests__version_serializable.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: crates/ruff_cli/src/version.rs
2+
source: crates/ruff/src/version.rs
33
expression: version
44
---
55
{
File renamed without changes.
File renamed without changes.
File renamed without changes.

crates/ruff_cli/tests/integration_test.rs renamed to crates/ruff/tests/integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ use path_absolutize::path_dedot;
2020
use tempfile::TempDir;
2121

2222
#[cfg(unix)]
23-
use ruff_cli::args::Args;
23+
use ruff::args::Args;
2424
#[cfg(unix)]
25-
use ruff_cli::run;
25+
use ruff::run;
2626

2727
const BIN_NAME: &str = "ruff";
2828

File renamed without changes.

crates/ruff_cli/tests/snapshots/integration_test__explain_status_codes_f401.snap renamed to crates/ruff/tests/snapshots/integration_test__explain_status_codes_f401.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: crates/ruff_cli/tests/integration_test.rs
2+
source: crates/ruff/tests/integration_test.rs
33
info:
44
program: ruff
55
args:

crates/ruff_cli/tests/snapshots/integration_test__stdin_json.snap renamed to crates/ruff/tests/snapshots/integration_test__stdin_json.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: crates/ruff_cli/tests/integration_test.rs
2+
source: crates/ruff/tests/integration_test.rs
33
info:
44
program: ruff
55
args:

crates/ruff_cli/tests/snapshots/show_settings__display_default_settings.snap renamed to crates/ruff/tests/snapshots/show_settings__display_default_settings.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: crates/ruff_cli/tests/show_settings.rs
2+
source: crates/ruff/tests/show_settings.rs
33
info:
44
program: ruff
55
args:
@@ -10,7 +10,7 @@ info:
1010
success: true
1111
exit_code: 0
1212
----- stdout -----
13-
Resolved settings for: "[BASEPATH]/crates/ruff_cli/resources/test/fixtures/unformatted.py"
13+
Resolved settings for: "[BASEPATH]/crates/ruff/resources/test/fixtures/unformatted.py"
1414
Settings path: "[BASEPATH]/pyproject.toml"
1515

1616
# General Settings

crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting.snap

Lines changed: 0 additions & 5 deletions
This file was deleted.

crates/ruff_dev/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ repository = { workspace = true }
1111
license = { workspace = true }
1212

1313
[dependencies]
14-
ruff_linter = { path = "../ruff_linter", features = ["schemars"] }
15-
ruff_cli = { path = "../ruff_cli" }
14+
ruff = { path = "../ruff" }
1615
ruff_diagnostics = { path = "../ruff_diagnostics" }
1716
ruff_formatter = { path = "../ruff_formatter" }
17+
ruff_linter = { path = "../ruff_linter", features = ["schemars"] }
18+
ruff_notebook = { path = "../ruff_notebook" }
1819
ruff_python_ast = { path = "../ruff_python_ast" }
1920
ruff_python_codegen = { path = "../ruff_python_codegen" }
2021
ruff_python_formatter = { path = "../ruff_python_formatter" }
21-
ruff_notebook = { path = "../ruff_notebook" }
2222
ruff_python_parser = { path = "../ruff_python_parser" }
2323
ruff_python_stdlib = { path = "../ruff_python_stdlib" }
2424
ruff_python_trivia = { path = "../ruff_python_trivia" }

crates/ruff_dev/src/format_dev.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use tracing_subscriber::layer::SubscriberExt;
2727
use tracing_subscriber::util::SubscriberInitExt;
2828
use tracing_subscriber::EnvFilter;
2929

30-
use ruff_cli::args::{CliOverrides, FormatArguments, FormatCommand, LogLevelArgs};
31-
use ruff_cli::resolve::resolve;
30+
use ruff::args::{CliOverrides, FormatArguments, FormatCommand, LogLevelArgs};
31+
use ruff::resolve::resolve;
3232
use ruff_formatter::{FormatError, LineWidth, PrintError};
3333
use ruff_linter::logging::LogLevel;
3434
use ruff_linter::settings::types::{FilePattern, FilePatternSet};
@@ -67,7 +67,7 @@ fn find_pyproject_config(
6767
Ok(pyproject_config)
6868
}
6969

70-
/// Find files that ruff would check so we can format them. Adapted from `ruff_cli`.
70+
/// Find files that ruff would check so we can format them. Adapted from `ruff`.
7171
#[allow(clippy::type_complexity)]
7272
fn ruff_check_paths<'a>(
7373
pyproject_config: &'a PyprojectConfig,
@@ -287,7 +287,7 @@ fn setup_logging(log_level_args: &LogLevelArgs, log_file: Option<&Path>) -> io::
287287
LogLevel::Quiet => tracing::Level::WARN,
288288
LogLevel::Silent => tracing::Level::ERROR,
289289
};
290-
// 1. `RUST_LOG=`, 2. explicit CLI log level, 3. info, the ruff_cli default
290+
// 1. `RUST_LOG=`, 2. explicit CLI log level, 3. info, the ruff default
291291
let filter_layer = EnvFilter::try_from_default_env().unwrap_or_else(|_| {
292292
EnvFilter::builder()
293293
.with_default_directive(log_level.into())
@@ -461,7 +461,7 @@ fn format_dev_project(
461461

462462
// TODO(konstin): Respect black's excludes.
463463

464-
// Find files to check (or in this case, format twice). Adapted from ruff_cli
464+
// Find files to check (or in this case, format twice). Adapted from ruff
465465
// First argument is ignored
466466
let (cli, overrides) = parse_cli(files)?;
467467
let pyproject_config = find_pyproject_config(&cli, &overrides)?;

crates/ruff_dev/src/generate_cli_help.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use anyhow::{bail, Context, Result};
88
use clap::CommandFactory;
99
use pretty_assertions::StrComparison;
1010

11-
use ruff_cli::args;
11+
use ruff::args;
1212

1313
use crate::generate_all::{Mode, REGENERATE_ALL_COMMAND};
1414
use crate::ROOT_DIR;

crates/ruff_dev/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use anyhow::Result;
66
use clap::{Parser, Subcommand};
7-
use ruff_cli::check;
7+
use ruff::check;
88
use ruff_linter::logging::{set_up_logging, LogLevel};
99
use std::process::ExitCode;
1010

@@ -56,9 +56,9 @@ enum Command {
5656
/// Run a ruff command n times for profiling/benchmarking
5757
Repeat {
5858
#[clap(flatten)]
59-
args: ruff_cli::args::CheckCommand,
59+
args: ruff::args::CheckCommand,
6060
#[clap(flatten)]
61-
log_level_args: ruff_cli::args::LogLevelArgs,
61+
log_level_args: ruff::args::LogLevelArgs,
6262
/// Run this many times
6363
#[clap(long)]
6464
repeat: usize,

0 commit comments

Comments
 (0)