Repository navigation
Replies: 4 comments
|
That would be very useful as a similar request made on pre-commit/pre-commit#1144 was refused. One suggestion would be to include the duration of the hook execution after the PASSED part when is longer than 1 second (or configurable). That would make the UI easier and not add extra lines of output. The idea of making visible the slow hooks will motivate people to check their configuration for mistakes (classic example of scanning files that are not tracked by git). If we include duration all the time it clutters the UI, but if we include duration only when is unexpected high, we provide valuable feedback. |
|
That might be a different type of request. Today it is already possible to get the duration when running with |
|
We would also find this very useful. If the info was available in a machine-readable format, we'd definitely upload it to our analytics platform, and we could see which checks are slow, which fail most often in the merge queue even though PR checks passed, etc. |
|
I have a related use case that I accidently created in a separate discussion here #2971 I'll just quote it for completeness:
I've found that you can do it pretty non-invasive (and fully optional) when you already use use If there's any interest I can make a PoC |
Uh oh!
There was an error while loading. Please reload this page.
Currently, if I want to measure the runtime of individual hooks, I can call
prek run -a -vand get something likeWhile I can parse this from stdout or the log file, it would be nice to have this output in a structured format, e.g. as json.
What do you think about adding an option to write this output into a json file.
Maybe as an additional reference, I have https://github.com/hofbi/dev-tools?tab=readme-ov-file#print-pre-commit-metrics as a way to measure the number of files excluded in the pre-commit config. Used together with https://github.com/hofbi/dev-tools?tab=readme-ov-file#check-non-existing-and-duplicate-excludes to enforce all files listed under
excludeactually exist, this is a nice way to track what hook is excluding how many files. Just as input for how the runtime metrics could look like.{ "total_excluded_files": XXX, "hooks": [ { "hook_id": "my-hook", "excluded_files_count": YYY }, ... }All reactions