Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

📎 Cap console output length when there are many errors #3593

Closed
joukevandermaas opened this issue Nov 8, 2022 · 2 comments · Fixed by #3595
Closed

📎 Cap console output length when there are many errors #3593

joukevandermaas opened this issue Nov 8, 2022 · 2 comments · Fixed by #3595
Assignees
Labels
A-CLI Area: CLI S-Bug: confirmed Status: report has been confirmed as a valid bug
Milestone

Comments

@joukevandermaas
Copy link

Description

For performance and usability reasons, it is best not to print too much text to the console when there are many errors. Instead, if the number of errors or the output length is over a certain threshold, either truncate the output or print a summary instead.

I ran this command in a fairly big (but not huge) repo:

rome format .

It took many minutes (almost 10) to print all of the errors on my development PC. I could never act on this many errors at once, and the execution time was completely dominated by printing the errors, rather than finding them. Prettier does not have any errors on this repo, but takes much less time to run (~30s).

In case it matters, I am using windows terminal 1.16.2642.0 on Windows 11 (22621.674). Although this terminal is known to be slow, I suspect this would also be an issue on other terminals and operating systems.

Note: the output itself is very good, I am not suggesting to reduce it or change it any way for the common case of only a few errors.

PS. I was on the fence between "bug" and "task" categories. I'm sorry if I picked wrong, this seemed to fit neither category that well.

@joukevandermaas joukevandermaas added the task A task, an action that needs to be performed label Nov 8, 2022
@leops
Copy link
Contributor

leops commented Nov 8, 2022

Thanks for the report. This is actually a bug, the CLI does have a cap for the number of diagnostics it's allowed to print (set with the --max-diagnostics CLI argument, defaults to 200) but the format diff diagnostic is mistakenly not being counted correctly.

@leops leops added S-Bug: confirmed Status: report has been confirmed as a valid bug A-CLI Area: CLI and removed task A task, an action that needs to be performed labels Nov 8, 2022
@sebmck
Copy link
Contributor

sebmck commented Nov 8, 2022

I think we can do some work on improving truncating individual diagnostics too. IIRC a diff for a file would be counted as a single diagnostic and would show every single line if something like indentation changed. We could cap showing the diff to a certain amount of lines.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-CLI Area: CLI S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants