|
| 1 | +use std::io::Write; |
1 | 2 | use std::process::ExitCode;
|
2 | 3 |
|
3 |
| -use clap::{Parser, Subcommand}; |
| 4 | +use clap::Parser; |
4 | 5 | use colored::Colorize;
|
5 |
| -use log::error; |
6 |
| -use std::io::Write; |
7 | 6 |
|
8 |
| -use ruff::args::{Args, Command}; |
| 7 | +use ruff::args::Args; |
9 | 8 | use ruff::{run, ExitStatus};
|
10 |
| -use ruff_linter::logging::{set_up_logging, LogLevel}; |
11 | 9 |
|
12 | 10 | #[cfg(target_os = "windows")]
|
13 | 11 | #[global_allocator]
|
@@ -41,47 +39,6 @@ pub fn main() -> ExitCode {
|
41 | 39 | let args = wild::args_os();
|
42 | 40 | let args = argfile::expand_args_from(args, argfile::parse_fromfile, argfile::PREFIX).unwrap();
|
43 | 41 |
|
44 |
| - // We can't use `warn_user` here because logging isn't set up at this point |
45 |
| - // and we also don't know if the user runs ruff with quiet. |
46 |
| - // Keep the message and pass it to `run` that is responsible for emitting the warning. |
47 |
| - let deprecated_alias_error = match args.get(1).and_then(|arg| arg.to_str()) { |
48 |
| - // Deprecated aliases that are handled by clap |
49 |
| - Some("--explain") => { |
50 |
| - Some("`ruff --explain <RULE>` has been removed. Use `ruff rule <RULE>` instead.") |
51 |
| - } |
52 |
| - Some("--clean") => { |
53 |
| - Some("`ruff --clean` has been removed. Use `ruff clean` instead.") |
54 |
| - } |
55 |
| - Some("--generate-shell-completion") => { |
56 |
| - Some("`ruff --generate-shell-completion <SHELL>` has been removed. Use `ruff generate-shell-completion <SHELL>` instead.") |
57 |
| - } |
58 |
| - // Deprecated `ruff` alias to `ruff check` |
59 |
| - // Clap doesn't support default subcommands but we want to run `check` by |
60 |
| - // default for convenience and backwards-compatibility, so we just |
61 |
| - // preprocess the arguments accordingly before passing them to Clap. |
62 |
| - Some(arg) if !Command::has_subcommand(arg) |
63 |
| - && arg != "-h" |
64 |
| - && arg != "--help" |
65 |
| - && arg != "-V" |
66 |
| - && arg != "--version" |
67 |
| - && arg != "help" => { |
68 |
| - { |
69 |
| - Some("`ruff <path>` has been removed. Use `ruff check <path>` instead.") |
70 |
| - } |
71 |
| - }, |
72 |
| - _ => None |
73 |
| - }; |
74 |
| - |
75 |
| - if let Some(error) = deprecated_alias_error { |
76 |
| - #[allow(clippy::print_stderr)] |
77 |
| - if set_up_logging(LogLevel::Default).is_ok() { |
78 |
| - error!("{}", error); |
79 |
| - } else { |
80 |
| - eprintln!("{}", error.red().bold()); |
81 |
| - } |
82 |
| - return ExitCode::FAILURE; |
83 |
| - } |
84 |
| - |
85 | 42 | let args = Args::parse_from(args);
|
86 | 43 |
|
87 | 44 | match run(args) {
|
|
0 commit comments