diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cb993e833dec2..8759c0002625e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ exclude: | (?x)^( crates/ruff_linter/resources/.*| crates/ruff_linter/src/rules/.*/snapshots/.*| - crates/ruff_cli/resources/.*| + crates/ruff/resources/.*| crates/ruff_python_formatter/resources/.*| crates/ruff_python_formatter/tests/snapshots/.*| crates/ruff_python_resolver/resources/.*| diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 178ac7dd40baf..498b7be22ae36 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,7 +81,7 @@ pre-commit install After cloning the repository, run Ruff locally from the repository root with: ```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, @@ -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. - `crates/ruff_benchmark`: binary crate for running micro-benchmarks. - `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., `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 @@ -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: ```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 @@ -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. -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 `Options` struct), `crates/ruff_workspace/src/configuration.rs` (via the `Configuration` struct), diff --git a/Cargo.lock b/Cargo.lock index 37ab4ab7c86eb..6c7bc8aab33af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2003,40 +2003,7 @@ dependencies = [ ] [[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]] -name = "ruff_cli" +name = "ruff" version = "0.1.13" dependencies = [ "anyhow", @@ -2086,6 +2053,39 @@ dependencies = [ "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]] name = "ruff_dev" version = "0.0.0" @@ -2102,7 +2102,7 @@ dependencies = [ "pretty_assertions", "rayon", "regex", - "ruff_cli", + "ruff", "ruff_diagnostics", "ruff_formatter", "ruff_linter", diff --git a/crates/ruff_cli/Cargo.toml b/crates/ruff/Cargo.toml similarity index 98% rename from crates/ruff_cli/Cargo.toml rename to crates/ruff/Cargo.toml index cb92c81ad94b6..a7eb8a7ce8390 100644 --- a/crates/ruff_cli/Cargo.toml +++ b/crates/ruff/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ruff_cli" +name = "ruff" version = "0.1.13" publish = false authors = { workspace = true } @@ -11,9 +11,6 @@ repository = { workspace = true } license = { workspace = true } readme = "../../README.md" -[[bin]] -name = "ruff" - [dependencies] ruff_cache = { path = "../ruff_cache" } ruff_diagnostics = { path = "../ruff_diagnostics" } diff --git a/crates/ruff_cli/build.rs b/crates/ruff/build.rs similarity index 100% rename from crates/ruff_cli/build.rs rename to crates/ruff/build.rs diff --git a/crates/ruff_cli/resources/test/fixtures/cache_mutable/.gitignore b/crates/ruff/resources/test/fixtures/cache_mutable/.gitignore similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/cache_mutable/.gitignore rename to crates/ruff/resources/test/fixtures/cache_mutable/.gitignore diff --git a/crates/ruff_cli/resources/test/fixtures/cache_remove_old_files/source.py b/crates/ruff/resources/test/fixtures/cache_remove_old_files/source.py similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/cache_remove_old_files/source.py rename to crates/ruff/resources/test/fixtures/cache_remove_old_files/source.py diff --git a/crates/ruff_cli/resources/test/fixtures/formatted.py b/crates/ruff/resources/test/fixtures/formatted.py similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/formatted.py rename to crates/ruff/resources/test/fixtures/formatted.py diff --git a/crates/ruff_cli/resources/test/fixtures/include-test/a.py b/crates/ruff/resources/test/fixtures/include-test/a.py similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/include-test/a.py rename to crates/ruff/resources/test/fixtures/include-test/a.py diff --git a/crates/ruff_cli/resources/test/fixtures/include-test/b.py b/crates/ruff/resources/test/fixtures/include-test/b.py similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/include-test/b.py rename to crates/ruff/resources/test/fixtures/include-test/b.py diff --git a/crates/ruff_cli/resources/test/fixtures/include-test/nested-project/e.py b/crates/ruff/resources/test/fixtures/include-test/nested-project/e.py similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/include-test/nested-project/e.py rename to crates/ruff/resources/test/fixtures/include-test/nested-project/e.py diff --git a/crates/ruff_cli/resources/test/fixtures/include-test/nested-project/pyproject.toml b/crates/ruff/resources/test/fixtures/include-test/nested-project/pyproject.toml similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/include-test/nested-project/pyproject.toml rename to crates/ruff/resources/test/fixtures/include-test/nested-project/pyproject.toml diff --git a/crates/ruff_cli/resources/test/fixtures/include-test/pyproject.toml b/crates/ruff/resources/test/fixtures/include-test/pyproject.toml similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/include-test/pyproject.toml rename to crates/ruff/resources/test/fixtures/include-test/pyproject.toml diff --git a/crates/ruff_cli/resources/test/fixtures/include-test/subdirectory/c.py b/crates/ruff/resources/test/fixtures/include-test/subdirectory/c.py similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/include-test/subdirectory/c.py rename to crates/ruff/resources/test/fixtures/include-test/subdirectory/c.py diff --git a/crates/ruff_cli/resources/test/fixtures/include-test/subdirectory/d.py b/crates/ruff/resources/test/fixtures/include-test/subdirectory/d.py similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/include-test/subdirectory/d.py rename to crates/ruff/resources/test/fixtures/include-test/subdirectory/d.py diff --git a/crates/ruff_cli/resources/test/fixtures/trailing_semicolon.ipynb b/crates/ruff/resources/test/fixtures/trailing_semicolon.ipynb similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/trailing_semicolon.ipynb rename to crates/ruff/resources/test/fixtures/trailing_semicolon.ipynb diff --git a/crates/ruff_cli/resources/test/fixtures/unformatted.ipynb b/crates/ruff/resources/test/fixtures/unformatted.ipynb similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/unformatted.ipynb rename to crates/ruff/resources/test/fixtures/unformatted.ipynb diff --git a/crates/ruff_cli/resources/test/fixtures/unformatted.py b/crates/ruff/resources/test/fixtures/unformatted.py similarity index 100% rename from crates/ruff_cli/resources/test/fixtures/unformatted.py rename to crates/ruff/resources/test/fixtures/unformatted.py diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff/src/args.rs similarity index 99% rename from crates/ruff_cli/src/args.rs rename to crates/ruff/src/args.rs index 4276fb0cc93a9..71890a0342c55 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff/src/args.rs @@ -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)] #[allow(clippy::struct_excessive_bools)] pub struct CheckCommand { diff --git a/crates/ruff_cli/src/cache.rs b/crates/ruff/src/cache.rs similarity index 100% rename from crates/ruff_cli/src/cache.rs rename to crates/ruff/src/cache.rs diff --git a/crates/ruff_cli/src/commands/add_noqa.rs b/crates/ruff/src/commands/add_noqa.rs similarity index 100% rename from crates/ruff_cli/src/commands/add_noqa.rs rename to crates/ruff/src/commands/add_noqa.rs diff --git a/crates/ruff_cli/src/commands/check.rs b/crates/ruff/src/commands/check.rs similarity index 100% rename from crates/ruff_cli/src/commands/check.rs rename to crates/ruff/src/commands/check.rs diff --git a/crates/ruff_cli/src/commands/check_stdin.rs b/crates/ruff/src/commands/check_stdin.rs similarity index 100% rename from crates/ruff_cli/src/commands/check_stdin.rs rename to crates/ruff/src/commands/check_stdin.rs diff --git a/crates/ruff_cli/src/commands/clean.rs b/crates/ruff/src/commands/clean.rs similarity index 100% rename from crates/ruff_cli/src/commands/clean.rs rename to crates/ruff/src/commands/clean.rs diff --git a/crates/ruff_cli/src/commands/config.rs b/crates/ruff/src/commands/config.rs similarity index 100% rename from crates/ruff_cli/src/commands/config.rs rename to crates/ruff/src/commands/config.rs diff --git a/crates/ruff_cli/src/commands/format.rs b/crates/ruff/src/commands/format.rs similarity index 100% rename from crates/ruff_cli/src/commands/format.rs rename to crates/ruff/src/commands/format.rs diff --git a/crates/ruff_cli/src/commands/format_stdin.rs b/crates/ruff/src/commands/format_stdin.rs similarity index 100% rename from crates/ruff_cli/src/commands/format_stdin.rs rename to crates/ruff/src/commands/format_stdin.rs diff --git a/crates/ruff_cli/src/commands/linter.rs b/crates/ruff/src/commands/linter.rs similarity index 100% rename from crates/ruff_cli/src/commands/linter.rs rename to crates/ruff/src/commands/linter.rs diff --git a/crates/ruff_cli/src/commands/mod.rs b/crates/ruff/src/commands/mod.rs similarity index 100% rename from crates/ruff_cli/src/commands/mod.rs rename to crates/ruff/src/commands/mod.rs diff --git a/crates/ruff_cli/src/commands/rule.rs b/crates/ruff/src/commands/rule.rs similarity index 100% rename from crates/ruff_cli/src/commands/rule.rs rename to crates/ruff/src/commands/rule.rs diff --git a/crates/ruff_cli/src/commands/show_files.rs b/crates/ruff/src/commands/show_files.rs similarity index 100% rename from crates/ruff_cli/src/commands/show_files.rs rename to crates/ruff/src/commands/show_files.rs diff --git a/crates/ruff_cli/src/commands/show_settings.rs b/crates/ruff/src/commands/show_settings.rs similarity index 100% rename from crates/ruff_cli/src/commands/show_settings.rs rename to crates/ruff/src/commands/show_settings.rs diff --git a/crates/ruff_cli/src/commands/snapshots/ruff_cli__commands__check__test__E902_E902.py.snap b/crates/ruff/src/commands/snapshots/ruff__commands__check__test__E902_E902.py.snap similarity index 83% rename from crates/ruff_cli/src/commands/snapshots/ruff_cli__commands__check__test__E902_E902.py.snap rename to crates/ruff/src/commands/snapshots/ruff__commands__check__test__E902_E902.py.snap index 7e5ca820ebf68..0f9000a8e12bd 100644 --- a/crates/ruff_cli/src/commands/snapshots/ruff_cli__commands__check__test__E902_E902.py.snap +++ b/crates/ruff/src/commands/snapshots/ruff__commands__check__test__E902_E902.py.snap @@ -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/notebook.ipynb:1:1: E902 Permission denied (os error 13) diff --git a/crates/ruff_cli/src/commands/version.rs b/crates/ruff/src/commands/version.rs similarity index 100% rename from crates/ruff_cli/src/commands/version.rs rename to crates/ruff/src/commands/version.rs diff --git a/crates/ruff_cli/src/diagnostics.rs b/crates/ruff/src/diagnostics.rs similarity index 100% rename from crates/ruff_cli/src/diagnostics.rs rename to crates/ruff/src/diagnostics.rs diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff/src/lib.rs similarity index 100% rename from crates/ruff_cli/src/lib.rs rename to crates/ruff/src/lib.rs diff --git a/crates/ruff_cli/src/bin/ruff.rs b/crates/ruff/src/main.rs similarity index 97% rename from crates/ruff_cli/src/bin/ruff.rs rename to crates/ruff/src/main.rs index 81830ca251bf3..8fbbe0e971919 100644 --- a/crates/ruff_cli/src/bin/ruff.rs +++ b/crates/ruff/src/main.rs @@ -3,8 +3,8 @@ use std::process::ExitCode; use clap::{Parser, Subcommand}; use colored::Colorize; -use ruff_cli::args::{Args, Command}; -use ruff_cli::{run, ExitStatus}; +use ruff::args::{Args, Command}; +use ruff::{run, ExitStatus}; #[cfg(target_os = "windows")] #[global_allocator] diff --git a/crates/ruff_cli/src/panic.rs b/crates/ruff/src/panic.rs similarity index 100% rename from crates/ruff_cli/src/panic.rs rename to crates/ruff/src/panic.rs diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff/src/printer.rs similarity index 100% rename from crates/ruff_cli/src/printer.rs rename to crates/ruff/src/printer.rs diff --git a/crates/ruff_cli/src/resolve.rs b/crates/ruff/src/resolve.rs similarity index 100% rename from crates/ruff_cli/src/resolve.rs rename to crates/ruff/src/resolve.rs diff --git a/crates/ruff/src/snapshots/ruff__version__tests__version_formatting.snap b/crates/ruff/src/snapshots/ruff__version__tests__version_formatting.snap new file mode 100644 index 0000000000000..501be194f8993 --- /dev/null +++ b/crates/ruff/src/snapshots/ruff__version__tests__version_formatting.snap @@ -0,0 +1,5 @@ +--- +source: crates/ruff/src/version.rs +expression: version +--- +0.0.0 diff --git a/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting_with_commit_info.snap b/crates/ruff/src/snapshots/ruff__version__tests__version_formatting_with_commit_info.snap similarity index 59% rename from crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting_with_commit_info.snap rename to crates/ruff/src/snapshots/ruff__version__tests__version_formatting_with_commit_info.snap index cdda49684aad8..b661aab1a7781 100644 --- a/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting_with_commit_info.snap +++ b/crates/ruff/src/snapshots/ruff__version__tests__version_formatting_with_commit_info.snap @@ -1,5 +1,5 @@ --- -source: crates/ruff_cli/src/version.rs +source: crates/ruff/src/version.rs expression: version --- 0.0.0 (53b0f5d92 2023-10-19) diff --git a/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting_with_commits_since_last_tag.snap b/crates/ruff/src/snapshots/ruff__version__tests__version_formatting_with_commits_since_last_tag.snap similarity index 60% rename from crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting_with_commits_since_last_tag.snap rename to crates/ruff/src/snapshots/ruff__version__tests__version_formatting_with_commits_since_last_tag.snap index 6330751c8a006..8b856e8cf2809 100644 --- a/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting_with_commits_since_last_tag.snap +++ b/crates/ruff/src/snapshots/ruff__version__tests__version_formatting_with_commits_since_last_tag.snap @@ -1,5 +1,5 @@ --- -source: crates/ruff_cli/src/version.rs +source: crates/ruff/src/version.rs expression: version --- 0.0.0+24 (53b0f5d92 2023-10-19) diff --git a/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_serializable.snap b/crates/ruff/src/snapshots/ruff__version__tests__version_serializable.snap similarity index 87% rename from crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_serializable.snap rename to crates/ruff/src/snapshots/ruff__version__tests__version_serializable.snap index 0a63628659679..afb49fad965a2 100644 --- a/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_serializable.snap +++ b/crates/ruff/src/snapshots/ruff__version__tests__version_serializable.snap @@ -1,5 +1,5 @@ --- -source: crates/ruff_cli/src/version.rs +source: crates/ruff/src/version.rs expression: version --- { diff --git a/crates/ruff_cli/src/stdin.rs b/crates/ruff/src/stdin.rs similarity index 100% rename from crates/ruff_cli/src/stdin.rs rename to crates/ruff/src/stdin.rs diff --git a/crates/ruff_cli/src/version.rs b/crates/ruff/src/version.rs similarity index 100% rename from crates/ruff_cli/src/version.rs rename to crates/ruff/src/version.rs diff --git a/crates/ruff_cli/tests/format.rs b/crates/ruff/tests/format.rs similarity index 100% rename from crates/ruff_cli/tests/format.rs rename to crates/ruff/tests/format.rs diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff/tests/integration_test.rs similarity index 99% rename from crates/ruff_cli/tests/integration_test.rs rename to crates/ruff/tests/integration_test.rs index 0bc044ea231a4..8c4c346d5b189 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff/tests/integration_test.rs @@ -20,9 +20,9 @@ use path_absolutize::path_dedot; use tempfile::TempDir; #[cfg(unix)] -use ruff_cli::args::Args; +use ruff::args::Args; #[cfg(unix)] -use ruff_cli::run; +use ruff::run; const BIN_NAME: &str = "ruff"; diff --git a/crates/ruff_cli/tests/lint.rs b/crates/ruff/tests/lint.rs similarity index 100% rename from crates/ruff_cli/tests/lint.rs rename to crates/ruff/tests/lint.rs diff --git a/crates/ruff_cli/tests/resolve_files.rs b/crates/ruff/tests/resolve_files.rs similarity index 100% rename from crates/ruff_cli/tests/resolve_files.rs rename to crates/ruff/tests/resolve_files.rs diff --git a/crates/ruff_cli/tests/show_settings.rs b/crates/ruff/tests/show_settings.rs similarity index 100% rename from crates/ruff_cli/tests/show_settings.rs rename to crates/ruff/tests/show_settings.rs diff --git a/crates/ruff_cli/tests/snapshots/integration_test__explain_status_codes_f401.snap b/crates/ruff/tests/snapshots/integration_test__explain_status_codes_f401.snap similarity index 96% rename from crates/ruff_cli/tests/snapshots/integration_test__explain_status_codes_f401.snap rename to crates/ruff/tests/snapshots/integration_test__explain_status_codes_f401.snap index f8e0c12dc7021..f2383eed68ef3 100644 --- a/crates/ruff_cli/tests/snapshots/integration_test__explain_status_codes_f401.snap +++ b/crates/ruff/tests/snapshots/integration_test__explain_status_codes_f401.snap @@ -1,5 +1,5 @@ --- -source: crates/ruff_cli/tests/integration_test.rs +source: crates/ruff/tests/integration_test.rs info: program: ruff args: diff --git a/crates/ruff_cli/tests/snapshots/integration_test__stdin_json.snap b/crates/ruff/tests/snapshots/integration_test__stdin_json.snap similarity index 94% rename from crates/ruff_cli/tests/snapshots/integration_test__stdin_json.snap rename to crates/ruff/tests/snapshots/integration_test__stdin_json.snap index c374117787954..590ea70ccf051 100644 --- a/crates/ruff_cli/tests/snapshots/integration_test__stdin_json.snap +++ b/crates/ruff/tests/snapshots/integration_test__stdin_json.snap @@ -1,5 +1,5 @@ --- -source: crates/ruff_cli/tests/integration_test.rs +source: crates/ruff/tests/integration_test.rs info: program: ruff args: diff --git a/crates/ruff_cli/tests/snapshots/show_settings__display_default_settings.snap b/crates/ruff/tests/snapshots/show_settings__display_default_settings.snap similarity index 98% rename from crates/ruff_cli/tests/snapshots/show_settings__display_default_settings.snap rename to crates/ruff/tests/snapshots/show_settings__display_default_settings.snap index d4a64f69e9522..ae92e615f048f 100644 --- a/crates/ruff_cli/tests/snapshots/show_settings__display_default_settings.snap +++ b/crates/ruff/tests/snapshots/show_settings__display_default_settings.snap @@ -1,5 +1,5 @@ --- -source: crates/ruff_cli/tests/show_settings.rs +source: crates/ruff/tests/show_settings.rs info: program: ruff args: @@ -10,7 +10,7 @@ info: success: true exit_code: 0 ----- 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" # General Settings diff --git a/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting.snap b/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting.snap deleted file mode 100644 index 7bd9a393de87c..0000000000000 --- a/crates/ruff_cli/src/snapshots/ruff_cli__version__tests__version_formatting.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: crates/ruff_cli/src/version.rs -expression: version ---- -0.0.0 diff --git a/crates/ruff_dev/Cargo.toml b/crates/ruff_dev/Cargo.toml index 43157c2010393..b7e6024eb3294 100644 --- a/crates/ruff_dev/Cargo.toml +++ b/crates/ruff_dev/Cargo.toml @@ -11,14 +11,14 @@ repository = { workspace = true } license = { workspace = true } [dependencies] -ruff_linter = { path = "../ruff_linter", features = ["schemars"] } -ruff_cli = { path = "../ruff_cli" } +ruff = { path = "../ruff" } ruff_diagnostics = { path = "../ruff_diagnostics" } 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_codegen = { path = "../ruff_python_codegen" } ruff_python_formatter = { path = "../ruff_python_formatter" } -ruff_notebook = { path = "../ruff_notebook" } ruff_python_parser = { path = "../ruff_python_parser" } ruff_python_stdlib = { path = "../ruff_python_stdlib" } ruff_python_trivia = { path = "../ruff_python_trivia" } diff --git a/crates/ruff_dev/src/format_dev.rs b/crates/ruff_dev/src/format_dev.rs index be52ec863e467..e692d0ecee587 100644 --- a/crates/ruff_dev/src/format_dev.rs +++ b/crates/ruff_dev/src/format_dev.rs @@ -27,8 +27,8 @@ use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::util::SubscriberInitExt; use tracing_subscriber::EnvFilter; -use ruff_cli::args::{CliOverrides, FormatArguments, FormatCommand, LogLevelArgs}; -use ruff_cli::resolve::resolve; +use ruff::args::{CliOverrides, FormatArguments, FormatCommand, LogLevelArgs}; +use ruff::resolve::resolve; use ruff_formatter::{FormatError, LineWidth, PrintError}; use ruff_linter::logging::LogLevel; use ruff_linter::settings::types::{FilePattern, FilePatternSet}; @@ -67,7 +67,7 @@ fn find_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)] fn ruff_check_paths<'a>( 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::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(|_| { EnvFilter::builder() .with_default_directive(log_level.into()) @@ -461,7 +461,7 @@ fn format_dev_project( // 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 let (cli, overrides) = parse_cli(files)?; let pyproject_config = find_pyproject_config(&cli, &overrides)?; diff --git a/crates/ruff_dev/src/generate_cli_help.rs b/crates/ruff_dev/src/generate_cli_help.rs index 1493a3814023b..7e29ae3df8156 100644 --- a/crates/ruff_dev/src/generate_cli_help.rs +++ b/crates/ruff_dev/src/generate_cli_help.rs @@ -8,7 +8,7 @@ use anyhow::{bail, Context, Result}; use clap::CommandFactory; use pretty_assertions::StrComparison; -use ruff_cli::args; +use ruff::args; use crate::generate_all::{Mode, REGENERATE_ALL_COMMAND}; use crate::ROOT_DIR; diff --git a/crates/ruff_dev/src/main.rs b/crates/ruff_dev/src/main.rs index e4e7a43d697c7..1feef7394a3a3 100644 --- a/crates/ruff_dev/src/main.rs +++ b/crates/ruff_dev/src/main.rs @@ -4,7 +4,7 @@ use anyhow::Result; use clap::{Parser, Subcommand}; -use ruff_cli::check; +use ruff::check; use ruff_linter::logging::{set_up_logging, LogLevel}; use std::process::ExitCode; @@ -56,9 +56,9 @@ enum Command { /// Run a ruff command n times for profiling/benchmarking Repeat { #[clap(flatten)] - args: ruff_cli::args::CheckCommand, + args: ruff::args::CheckCommand, #[clap(flatten)] - log_level_args: ruff_cli::args::LogLevelArgs, + log_level_args: ruff::args::LogLevelArgs, /// Run this many times #[clap(long)] repeat: usize, diff --git a/crates/ruff_linter/resources/test/project/README.md b/crates/ruff_linter/resources/test/project/README.md index c112d716923f7..dbd91047e70b9 100644 --- a/crates/ruff_linter/resources/test/project/README.md +++ b/crates/ruff_linter/resources/test/project/README.md @@ -8,7 +8,7 @@ behaviors. Running from the repo root should pick up and enforce the appropriate settings for each package: ```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: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 @@ -23,7 +23,7 @@ Found 7 errors. Running from the project directory itself should exhibit the same behavior: ```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:8: F401 [*] `numpy` 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: ```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:8:5: F841 [*] Local variable `x` is assigned to but never used Found 2 errors. @@ -50,7 +50,7 @@ Found 2 errors. file paths from the current working directory: ```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: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 @@ -68,7 +68,7 @@ Running from a parent directory should "ignore" the `exclude` (hence, `concepts/ included in the output): ```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/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 @@ -80,7 +80,7 @@ Found 4 errors. Passing an excluded directory directly should report errors in the contained files: ```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 Found 1 error. [*] 1 potentially fixable with the --fix option. @@ -89,8 +89,8 @@ Found 1 error. Unless we `--force-exclude`: ```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) -∴ 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) ``` diff --git a/crates/ruff_linter/src/rule_selector.rs b/crates/ruff_linter/src/rule_selector.rs index a5ee86ea23353..2f6e7a5da12ac 100644 --- a/crates/ruff_linter/src/rule_selector.rs +++ b/crates/ruff_linter/src/rule_selector.rs @@ -108,7 +108,7 @@ pub(crate) fn is_single_rule_selector(prefix: &RuleCodePrefix) -> bool { pub enum ParseError { #[error("Unknown rule selector: `{0}`")] // 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), } diff --git a/crates/ruff_workspace/src/configuration.rs b/crates/ruff_workspace/src/configuration.rs index 6e6742cdab8dc..18e7551f556de 100644 --- a/crates/ruff_workspace/src/configuration.rs +++ b/crates/ruff_workspace/src/configuration.rs @@ -895,7 +895,7 @@ impl LintConfiguration { } 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!( from, "`{from}` has been remapped to `{}{}`.", diff --git a/pyproject.toml b/pyproject.toml index 670cfbd2525d1..6fb603d938e94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ Changelog = "https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md" [tool.maturin] bindings = "bin" -manifest-path = "crates/ruff_cli/Cargo.toml" +manifest-path = "crates/ruff/Cargo.toml" module-name = "ruff" python-source = "python" strip = true @@ -93,7 +93,7 @@ changelog_contributors = false version_files = [ "README.md", "docs/integrations.md", - "crates/ruff_cli/Cargo.toml", + "crates/ruff/Cargo.toml", "crates/ruff_linter/Cargo.toml", "crates/ruff_shrinking/Cargo.toml", "scripts/benchmarks/pyproject.toml", diff --git a/scripts/generate_mkdocs.py b/scripts/generate_mkdocs.py index 1d1226313598a..8ab84fe3370aa 100644 --- a/scripts/generate_mkdocs.py +++ b/scripts/generate_mkdocs.py @@ -149,7 +149,7 @@ def main() -> None: "cargo", "run", "-p", - "ruff_cli", + "ruff", "--", "rule", "--all",