Skip to content

Add support for quiet mode for git outputs globally #1512

@deX-de

Description

@deX-de

Summary

Add support for an environment variable (or something similar) that changes the default behavior to quiet git outputs for prek.

Motivation

Many users will not always use the CLI to run prek run --quiet before committing their changes.
Currently, whenever a git hook fails, the whole output is shown.
The passing and skipped hooks within the output can be very noisy, especially when relying on a large amount of them.
Furthermore, VSCode only shows one line of the output (see microsoft/vscode#169871) while PyCharm only shows a small pop-up window, where you have to scroll down to see the error.

There is also a popular issue for pre-commit (pre-commit/pre-commit#823) that was seemingly abandoned.

Proposed behavior

When setting the environment variable e.g. export PREK_QUIET='True', all behavior of prek is silent (only shows failed hooks).
That includes:

  • prek run
  • All git hook stages (commit-msg, post-checkout, post-commit, post-merge, post-rewrite, pre-commit, pre-merge-commit, pre-push, pre-rebase, prepare-commit-msg) e.g. assuming an otherwise passing commit, the output of git commit -m 'non convention' when using the conventional-pre-commit hook should ONLY show the output of conventional-pre-commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions