Skip to content

Commit 4db5c29

Browse files
vinhocentzanieb
andauthored
Indicated Successful Check (#8631)
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary Adds a successful check message after no errors were found  Implements #8553 <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan Ran a check on a test file with `cargo run -p ruff_cli -- check test.py --no-cache` and outputted as expected. Ran the same check with `cargo run -p ruff_cli -- check test.py --no-cache --silent` and the command was gone as expected. <!-- How was it tested? --> --------- Co-authored-by: Zanie Blue <[email protected]>
1 parent e9d3f71 commit 4db5c29

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

crates/ruff/src/printer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ impl Printer {
118118
} else if remaining > 0 {
119119
let s = if remaining == 1 { "" } else { "s" };
120120
writeln!(writer, "Found {remaining} error{s}.")?;
121+
} else if remaining == 0 {
122+
writeln!(writer, "All checks passed!")?;
121123
}
122124

123125
if let Some(fixables) = fixables {

crates/ruff/tests/integration_test.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ fn stdin_success() {
101101
success: true
102102
exit_code: 0
103103
----- stdout -----
104+
All checks passed!
104105
105106
----- stderr -----
106107
"###);
@@ -222,6 +223,7 @@ fn stdin_source_type_pyi() {
222223
success: true
223224
exit_code: 0
224225
----- stdout -----
226+
All checks passed!
225227
226228
----- stderr -----
227229
"###);
@@ -590,6 +592,7 @@ fn stdin_fix_when_no_issues_should_still_print_contents() {
590592
print(sys.version)
591593
592594
----- stderr -----
595+
All checks passed!
593596
"###);
594597
}
595598

@@ -1023,6 +1026,7 @@ fn preview_disabled_direct() {
10231026
success: true
10241027
exit_code: 0
10251028
----- stdout -----
1029+
All checks passed!
10261030
10271031
----- stderr -----
10281032
warning: Selection `RUF911` has no effect because preview is not enabled.
@@ -1039,6 +1043,7 @@ fn preview_disabled_prefix_empty() {
10391043
success: true
10401044
exit_code: 0
10411045
----- stdout -----
1046+
All checks passed!
10421047
10431048
----- stderr -----
10441049
warning: Selection `RUF91` has no effect because preview is not enabled.
@@ -1055,6 +1060,7 @@ fn preview_disabled_does_not_warn_for_empty_ignore_selections() {
10551060
success: true
10561061
exit_code: 0
10571062
----- stdout -----
1063+
All checks passed!
10581064
10591065
----- stderr -----
10601066
"###);
@@ -1070,6 +1076,7 @@ fn preview_disabled_does_not_warn_for_empty_fixable_selections() {
10701076
success: true
10711077
exit_code: 0
10721078
----- stdout -----
1079+
All checks passed!
10731080
10741081
----- stderr -----
10751082
"###);
@@ -1175,6 +1182,7 @@ fn removed_indirect() {
11751182
success: true
11761183
exit_code: 0
11771184
----- stdout -----
1185+
All checks passed!
11781186
11791187
----- stderr -----
11801188
"###);
@@ -1205,6 +1213,7 @@ fn redirect_indirect() {
12051213
success: true
12061214
exit_code: 0
12071215
----- stdout -----
1216+
All checks passed!
12081217
12091218
----- stderr -----
12101219
"###);
@@ -1307,6 +1316,7 @@ fn deprecated_indirect_preview_enabled() {
13071316
success: true
13081317
exit_code: 0
13091318
----- stdout -----
1319+
All checks passed!
13101320
13111321
----- stderr -----
13121322
"###);
@@ -1383,6 +1393,7 @@ fn unreadable_dir() -> Result<()> {
13831393
success: true
13841394
exit_code: 0
13851395
----- stdout -----
1396+
All checks passed!
13861397
13871398
----- stderr -----
13881399
warning: Encountered error: Permission denied (os error 13)
@@ -1897,6 +1908,7 @@ def log(x, base) -> float:
18971908
success: true
18981909
exit_code: 0
18991910
----- stdout -----
1911+
All checks passed!
19001912
19011913
----- stderr -----
19021914
"###

crates/ruff/tests/lint.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ ignore = ["D203", "D212"]
496496
success: true
497497
exit_code: 0
498498
----- stdout -----
499+
All checks passed!
499500
500501
----- stderr -----
501502
warning: No Python files found under the given path(s)
@@ -833,6 +834,7 @@ fn complex_config_setting_overridden_via_cli() -> Result<()> {
833834
success: true
834835
exit_code: 0
835836
----- stdout -----
837+
All checks passed!
836838
837839
----- stderr -----
838840
"###);

0 commit comments

Comments
 (0)