-
Notifications
You must be signed in to change notification settings - Fork 13.8k
make tidy slightly less noisy #146580
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
make tidy slightly less noisy #146580
Conversation
See also #146316 |
I think I would be very much in favor of somehow making this easier to tell what's "INFO"-level versus what's "WARN"/"ERROR"-level. r? Kobzol (won't get to this during weekday) |
It's funny that we have just discussed this exact thing last week in #146316 😆 As was noted there, the output that something was (or was not) checked is actually useful, because tidy can do various optional things and it's not always obvious if it did check something successfully or if that check was actually skipped. I think that an ideal solution would be to use some more comprehensive logging system in tidy, which would make it obvious where the individual checks start and end, and what is their conclusion. But that would be more work, ofc. A temporary solution might be to print a big green "EVERYTHING IS FINE" message when tidy ends successfully. Would that help you understand what is the outcome of tidy execution? |
This PR doesn't remove the lines that say "checking x...". But it removes the lines saying "X was not changed", which is an entirely pointless thing to say IMO. We also don't list all the files that did not get changed and hence don't have their format checked (for obvious reasons, but the same reasons apply for the other checks as well IMO). This seems separate from the question of how to format the various "checking foo..." messages -- I think the output of our test harness is a good template for that, but obviously making that all consistent is a bunch of work. |
That specific message is there because tidy has essentially three modes for doing optional checks - don't check, check always, and check only if the input files were modified. So ideally, it should print something like "check disabled" vs "check skipped" to make it clear that the files weren't completely ignored. @GuillaumeGomez Do you find the information that the rustdoc files were not modified valuable enough to keep it in tidy, even though it's a bit spammy? |
Everyone is seeing those messages, and 99% of the time people aren't even aware what those rustdoc files do. In which sense is that check even optional? I didn't enable it, it seems to be on-by-default. If you want to know when it ran on a file, have it print the files it works on (similar to what fmt already does). That way it's only verbose in the rare case that someone actually changed the file. |
Implemented #146592 to solve this in a more structured way. |
Wow, that's huge! I'll close this one then. Thanks a ton :-) |
I need to know that it was at least checked that there was nothing to check (ie, no rustdoc file modified). Otherwise it's hard to know whether the files are now ignored by tidy or if they're actually ignored for a good reason. |
I don't see why rustdoc would be so special that everyone needs to be constantly reminded that they did, in fact, not change rustdoc. We also don't do this for all the other things tidy checks. |
I don't think that rustdoc is special but that the others that aren't checked all the time should also mention that there is nothing to be checked for them. |
No, they shouldn't. That just doesn't scale. We can fill entire screens with all the things we are not checking. Why would tidy forget to check these files when they do get changed? Are you expecting someone to break tidy's logic or so? We have tests and reviews for that. But nowhere else do we give such a detailed trace of what something does out of paranoia that it might change one day. Again, just imagine rustc or Miri or clippy worked like that. They'd be entirely unusable. |
Well, considering how many times these tests broke because files were moved/renamed, I don't think it's paranoia, just carefulness. You'll note that we don't display each rustdoc file that is ignored, just that a rustdoc tidy check was skipped. A few lines of output is fine. |
Tragedy of the commons. A few lines of output in your own pet tool only you use is fine. A few lines of output in large shared infrastructure, multiplied by a dozen projects each adding a few lines of output, is a mess. The only reason it's not a mess yet is that everyone else kept their checks quiet. The fact that two team members independently went so far as to actually make a PR to cut down the output should make it clear that there's a real concern here. |
Sure, but how many lines are we talking about exactly here? |
I think that a reasonable compromise might be to only print this line if the |
That sounds like an acceptable compromise indeed. 👍 |
I'm looking forward to #146592. :) |
Implement a simple diagnostic system for tidy In #146316 and #146580, contributors independently wanted to reduce the verbose output of tidy. But before, the output was quite ad-hoc, so it was not easy to control it. In this PR, I implemented a simple diagnostic system for tidy, which allows us to: 1) Only print certain information in verbose mode (`-v`) 2) Associate each (error) output to a specific check, so that it is easier to find out what exactly has failed and which check you might want to examine (not fully done, there are some random `println`s left, but most output should be scoped to a specific check) 3) Print output with colors, based on the message level (message, warning, error) 4) Show the start/end execution of each check in verbose mode, for better progress indication Failure output: <img width="1134" height="157" alt="image" src="https://github.com/user-attachments/assets/578a9302-e1c2-47e5-9370-a3556c49d9fc" /> Success output: <img width="388" height="113" alt="image" src="https://github.com/user-attachments/assets/cf27faf8-3d8b-49e3-88d0-fac27a9c36a8" /> Verbose output (shortened): <img width="380" height="158" alt="image" src="https://github.com/user-attachments/assets/ce7102b8-c2f3-42a8-a2ec-ca30389be91e" /> CC `@nnethercote` `@RalfJung` `@GuillaumeGomez` The first two commits and the last commit are interesting, the rest is just mechanical port of the code from `bad: &mut bool` to `DiagCtx` and `RunningCheck`. The `extra_checks` check could be further split, but I'd leave that for another PR. r? `@jieyouxu`
Implement a simple diagnostic system for tidy In rust-lang#146316 and rust-lang#146580, contributors independently wanted to reduce the verbose output of tidy. But before, the output was quite ad-hoc, so it was not easy to control it. In this PR, I implemented a simple diagnostic system for tidy, which allows us to: 1) Only print certain information in verbose mode (`-v`) 2) Associate each (error) output to a specific check, so that it is easier to find out what exactly has failed and which check you might want to examine (not fully done, there are some random `println`s left, but most output should be scoped to a specific check) 3) Print output with colors, based on the message level (message, warning, error) 4) Show the start/end execution of each check in verbose mode, for better progress indication Failure output: <img width="1134" height="157" alt="image" src="https://github.com/user-attachments/assets/578a9302-e1c2-47e5-9370-a3556c49d9fc" /> Success output: <img width="388" height="113" alt="image" src="https://github.com/user-attachments/assets/cf27faf8-3d8b-49e3-88d0-fac27a9c36a8" /> Verbose output (shortened): <img width="380" height="158" alt="image" src="https://github.com/user-attachments/assets/ce7102b8-c2f3-42a8-a2ec-ca30389be91e" /> CC `@nnethercote` `@RalfJung` `@GuillaumeGomez` The first two commits and the last commit are interesting, the rest is just mechanical port of the code from `bad: &mut bool` to `DiagCtx` and `RunningCheck`. The `extra_checks` check could be further split, but I'd leave that for another PR. r? `@jieyouxu`
For some reason, tidy prints a bunch of stuff even when there's nothing to complain about. That's not great, it means there's a bunch of text one has to parse to understand if there's any errors hidden inside those messages.
With this patch, the output for me is
Do these lines saying what is being checked make sense? I kept them for now because it may be that the error messages are hard to parse without that context, though ideally the errors would all establish this context themselves.
Do we really need to list all files that are being formatted?