Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicated Successful Check #8631

Merged
merged 4 commits into from
Mar 13, 2024
Merged

Conversation

vinhocent
Copy link
Contributor

Summary

Adds a successful check message after no errors were found 
Implements #8553

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.

@vinhocent
Copy link
Contributor Author

I'm wondering how to add the counting for the number of files checked - I see that it lives in check.rs here but this stat isn't available in diagnostics, is it?

image

@vinhocent
Copy link
Contributor Author

Also in the case of tests like this:
image

Do we even want to output a successful check?

@konstin
Copy link
Member

konstin commented Nov 13, 2023

No, we should fail there but currently don't

@konstin konstin requested a review from zanieb November 13, 2023 11:09
@nm-remarkable
Copy link
Contributor

This might cause issues with pre-commit since that framework uses "any message at the output" as error. Or bash pre-commit hooks.

@hughhan1
Copy link

No, we should fail there but currently don't

@konstin, by "fail", do you specifically mean that we should be exiting with a non-zero exit code? And perhaps continuing to have nothing dumped to stdout?

@konstin
Copy link
Member

konstin commented Jan 18, 2024

by "fail", do you specifically mean that we should be exiting with a non-zero exit code?

yes

@zanieb zanieb self-assigned this Mar 2, 2024
Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@konstin this seems very simple, my only thought is maybe we should have a different message that's in a different format so it's obviously distinct e.g. "No errors found" (I don't love exact message that since it sounds like an error)

@charliermarsh any ideas?

I'd also like to say how many files we scanned e.g. "Found 0 errors in 125 files" would be helpful to know it actually scanned something. We can track that separately.

@konstin
Copy link
Member

konstin commented Mar 11, 2024

Slight preference for something like "All checks passed" over something that contains the word error, otherwise i'm on board.

@zanieb
Copy link
Member

zanieb commented Mar 11, 2024

I like "All checks passed" although it's a little outside our normal terminology

# Conflicts:
#	crates/ruff_cli/tests/integration_test.rs
@zanieb zanieb enabled auto-merge (squash) March 13, 2024 18:59
@zanieb zanieb added the cli Related to the command-line interface label Mar 13, 2024
@zanieb zanieb merged commit 4db5c29 into astral-sh:main Mar 13, 2024
17 checks passed
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@zanieb
Copy link
Member

zanieb commented Mar 21, 2024

I'm not sure what to say here. A configuration option for this seems excessive and it is significantly friendlier for Ruff to indicate that it did something. If you want to open an issue requesting a configuration option, we can consider it. I'd want to see significant community feedback that this is important first though.

@silverwind
Copy link

silverwind commented Mar 21, 2024

Sorry, I figured out that -q actually works as expected and suppresses this logging just fine, so I deleted my rant. So nothing to do and sorry for the noise :)

@zanieb
Copy link
Member

zanieb commented Mar 21, 2024

Oh great! :)

@alexeagle
Copy link

that framework uses "any message at the output" as error

https://github.com/aspect-build/rules_lint/blob/main/docs/lint_test.md is one such tool. It is used by Bazel users to assert "no warnings were produced by the tool". So this change broke our tests. From what I can tell, ruff is the only linter we integrate that prints on success.

issue requesting a configuration option, we can consider it. I'd want to see significant community feedback that this is important

Here's some other linter decisions on this:

So I think rather than add an option, ruff should go back to the old silent-on-success behavior.

@MichaReiser
Copy link
Member

MichaReiser commented Mar 27, 2024

@alexeagle would you mind creating a new issue for this to avoid having discussions on merged PRs. Thank you

I wonder if it would be sufficient to test if Ruff's in an interactive terminal and only then print the message.

@alexeagle
Copy link

@MichaReiser thanks for the quick reply, since the issue requesting this change is still open, I've just commented there: #8553 (comment)

@zanieb
Copy link
Member

zanieb commented Mar 27, 2024

Thanks for moving the discussion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command-line interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants