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

Add a flag to tell users which files were fixed, and via which rules #2661

Closed
charliermarsh opened this issue Feb 8, 2023 · 2 comments · Fixed by #2707
Closed

Add a flag to tell users which files were fixed, and via which rules #2661

charliermarsh opened this issue Feb 8, 2023 · 2 comments · Fixed by #2707
Labels
cli Related to the command-line interface

Comments

@charliermarsh
Copy link
Member

No description provided.

@charliermarsh charliermarsh added the cli Related to the command-line interface label Feb 8, 2023
@charliermarsh
Copy link
Member Author

@henryiii - Sorry for the ping, but one more question here. At least in your case, would you want to see this output on every Ruff invocation? Or would it be sufficient to include it when run with --verbose, e.g., for debugging purposes?

@henryiii
Copy link
Contributor

henryiii commented Feb 9, 2023

I'd prefer it on every Ruff invocation - it's just as important as the list of things that are fixable, and no more verbose than that list if you didn't pass the --fix. Knowing what it changed and why is just as important as what still needs to be done, and I'd just run it again if I wanted only the remaining fixable items (I do that with Rubocop, actually). But I'm totally fine with it being a flag too, I'd just add it to pre-commit's args. I woudn't want too much extra info, though - the file, line number, code, and reason for the unfixed checks is just about perfect for the fixed checks too.

Recent example: I added a noqa for a problem, then ran Ruff:

ruff.....................................................................Failed
- hook id: ruff
- exit code: 1
- files were modified by this hook

tests/test_command.py:413:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
Found 2 errors (1 fixed, 1 remaining).

It deleted the noqa I added (since I missed by one line, I put it on the inner with instead of the outer with). But I can't tell that it did that from the output above; if I got the RUF00x noqa removal fix listed as "fixed", it would be much clearer what happened.

Ref: wntrblm/nox#691

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 a pull request may close this issue.

2 participants