Skip to content

Commit

Permalink
When only unsafe fixes are available, include note that no fixes are …
Browse files Browse the repository at this point in the history
…available first (#7950)

I believe this is a bit clearer.

When no fixes are available (safe _and_ unsafe) we will not include a
message at all.
  • Loading branch information
zanieb authored Oct 13, 2023
1 parent 8255e4e commit ddffadb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/ruff_cli/src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl Printer {
"es"
};
writeln!(writer,
"{} hidden fix{es} can be enabled with the `--unsafe-fixes` option.",
"No fixes available ({} hidden fix{es} can be enabled with the `--unsafe-fixes` option).",
fixables.unapplicable_unsafe
)?;
}
Expand Down
10 changes: 5 additions & 5 deletions crates/ruff_cli/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ fn check_hints_hidden_unsafe_fixes_with_no_safe_fixes() {
----- stdout -----
-:1:14: F601 Dictionary key literal `'a'` repeated
Found 1 error.
1 hidden fix can be enabled with the `--unsafe-fixes` option.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).
----- stderr -----
"###);
Expand Down Expand Up @@ -1002,7 +1002,7 @@ fn fix_applies_safe_fixes_by_default() {
----- stderr -----
-:1:14: F601 Dictionary key literal `'a'` repeated
Found 2 errors (1 fixed, 1 remaining).
1 hidden fix can be enabled with the `--unsafe-fixes` option.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).
"###);
}

Expand Down Expand Up @@ -1112,7 +1112,7 @@ fn fix_only_unsafe_fixes_available() {
----- stderr -----
-:1:14: F601 Dictionary key literal `'a'` repeated
Found 1 error.
1 hidden fix can be enabled with the `--unsafe-fixes` option.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).
"###);
}

Expand Down Expand Up @@ -1317,7 +1317,7 @@ extend-unsafe-fixes = ["UP034"]
-:1:14: F601 Dictionary key literal `'a'` repeated
-:2:7: UP034 Avoid extraneous parentheses
Found 2 errors.
2 hidden fixes can be enabled with the `--unsafe-fixes` option.
No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option).
----- stderr -----
"###);
Expand Down Expand Up @@ -1397,7 +1397,7 @@ extend-safe-fixes = ["UP034"]
-:1:14: F601 Dictionary key literal `'a'` repeated
-:2:7: UP034 Avoid extraneous parentheses
Found 2 errors.
2 hidden fixes can be enabled with the `--unsafe-fixes` option.
No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option).
----- stderr -----
"###);
Expand Down

0 comments on commit ddffadb

Please sign in to comment.