Skip to content

Print 10 violations in normal mode #71

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mpickering
Copy link

Using --verbose on a large project prints out too much output (see haskell/cabal#10744)

Printing out all the violations if there are a lot of them is quite slow, printing out a lot to stdout is not that fast.

Therefore we reach a compromise where we print up to 10 reasons for failure and omit the rest. If you want all the failures you can use --verbose.

Fixes #48


What do you think @andreasabel ? The other solution I can think of was to add a flag which controlled whether violations were printed out.

Using --verbose on a large project prints out too much output
(see haskell/cabal#10744)

Printing out all the violations if there are a lot of them is quite
slow, printing out a lot to stdout is not that fast.

Therefore we reach a compromise where we print up to 10 reasons for
failure and omit the rest. If you want all the failures you can use
--verbose.

Fixes agda#48
@ulysses4ever
Copy link
Contributor

Therefore we reach a compromise where we print up to 10 reasons for failure and omit the rest. If you want all the failures you can use --verbose.

Sounds good to me.

@ulysses4ever
Copy link
Contributor

ulysses4ever commented Mar 14, 2025

On the second thought... I think the issue in the past was that collecting violations slowed down the tool quite a bit. That's why it was hidden behind the --verbose flag:

So, this patch probably gets back to square one?

Re-using the verbose flag was also a bad idea because on big projects just printing out file names (what verbose have been always doing) quickly becomes overwhelming. So, I think, more flags are necessary anyway. E.g. verbose should be unrelated to printing violations, and a new flag with a numeric value and a default would say whether to print violations and if yes, how many. For instance --violations with 0 as the default -- and --violations 10 to do what this patch does.

@mpickering
Copy link
Author

@ulysses4ever I checked the profile and the slow part is printing the violations to stdout. Always collecting warnings is slightly slower, but not noticeable.

@ulysses4ever
Copy link
Contributor

Oh, that’s good then. I still think decoupling violations printing from --verbose would be a good improvement but may be it can be done separately.

Just FYI, I can’t approve things here, just sticking around as a past contributor.

@mpickering
Copy link
Author

Thanks Artem.

I don't mind splitting up the flag if that's what @andreasabel prefers. My goal is a solution which can run on CI and you can see what the violations are.

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

Successfully merging this pull request may close these issues.

Performance problem with error message feature
2 participants