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

treefmt's report is confusing #339

Closed
michaelpj opened this issue Jul 4, 2024 · 4 comments · Fixed by #340
Closed

treefmt's report is confusing #339

michaelpj opened this issue Jul 4, 2024 · 4 comments · Fixed by #340
Assignees
Labels
enhancement New feature or request

Comments

@michaelpj
Copy link

Forked from discussion in #336.

When treefmt says it matched a file, that means 3495 files matched at least one of the includes globs for a formatter. It then applied those formatters, and afterwards only 51 files had actually changed.

That really isn't how it reads to me, for what it's worth. "formatted" reads like "ran the formatter on" not "ran the formatter on, and changed".

Especially the "formatted X files in Y seconds" line is weird - the time is associated with all the files you ran the formatters on, not the ones that changed!

I would find something like this clearer:

traversed 41932 files
emitted 41932 files for processing
formatted 34771 files (20181 changed) in 24.579394143s

Even better, ditch the first two lines, or demote them to verbose logging. In some circumstances I might be interested in how many files were looked at but not formatted, but not every time!

Or controversially: demote it all to verbose logging. Many formatters work like that, and indeed the information about how many files got changed and how long it took is also readily available from git and time if you want it.

@michaelpj michaelpj added the enhancement New feature or request label Jul 4, 2024
@brianmcgee
Copy link
Member

I like having the message emitted each time, but I'll grant you that the phrasing is not clear. There have been a few attempts at getting it right, and I'll admit I like your suggestion.

@brianmcgee brianmcgee self-assigned this Jul 4, 2024
@brianmcgee brianmcgee mentioned this issue Jul 4, 2024
1 task
@mergify mergify bot closed this as completed in #340 Jul 5, 2024
@zimbatm
Copy link
Member

zimbatm commented Jul 5, 2024

The original idea was to pit the formatters against each other.

Display the timing of the formatters, so the users could see the culprit slowing everything down.

That was the intent. Then over time it slowly morphed into the current design.

@brianmcgee
Copy link
Member

🤔 at info level it logs individual formatting times as it applies them to batches.

Could add a summary/ranking output of some form which would be useful to see where it's spending most of it's time.

@zimbatm
Copy link
Member

zimbatm commented Jul 7, 2024

How about:

Summary: SHAME. Formatter X is Y times slower than everyone else

:-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants