-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add a less verbose second hook #269
Comments
A version that preserves the coloring of entry: bash -c '! script -fqc "$(printf "%q " pyright "$@")" /dev/null | grep --color=never -Po "(?<=$PWD/)(.*:.*)"' -- EDIT: This should also work entry: sh -c '! script -c "pyright $*" /dev/null | grep --color=never -Po "(?<=$PWD/)(.*:.*)"' -- |
There seems to be no interest in such a feature, therefore closing. People who want more concise output can use a config like: - repo: https://github.com/RobertCraigie/pyright-python
rev: <version>
hooks:
- id: pyright
entry: |
sh -c '
result=$(script -c "pyright $*" /dev/null | grep --color=never -Po "(?<=$PWD/)(.*:.*)");
count=$(echo -n "$result" | grep -c "^");
if [ "$count" -ne 0 ]; then
echo "$result";
echo "\033[1;31mFound ${count} errors\033[0m";
exit 1;
fi
' -- |
Sorry for the lack of response @randolf-scholz, to be clear you'd want the ouptut to just include the number of errors / warnings, no additional information? |
|
pyright
's output is quite verbose for a pre-commit hook. We can combine it with grep to give much less verbose output:Does it make sense to add this as a second hook, maybe "pyright-minimal"?
Of course, a caveat here is that it is less robust and could silently fail if
$PWD
contains funny special characters.The text was updated successfully, but these errors were encountered: