-
Notifications
You must be signed in to change notification settings - Fork 430
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
I can fix some stuff automatically, do you want me to? (yes/no) [no]: > % #1000
Comments
Hello @stijn-at-work The article has this note:
During pre-commit, the git diff is being piped into grumphp, meaning thet grumphp runs in non-interactive mode and you are not able to give an answer the question during pre-commit. I haven't found a solution for that problem yet. |
i think i have a solution: i add <dev/tty in pre-commit hook cd .git/hooks
|
@stijn-at-work cool! Not sure if that will work on all systems and in all situations. This requires some additional testing |
It works in our office on mac and windows. |
Nice. Will also have to make sure it works on docker setups. Doesn't it overwrite the stdin stream and therefore skips the diff that if being piped into it? Just thinking out loud: |
Thanks @stijn-at-work adding This is my grumphp.yaml.dist grumphp:
hooks_dir: './tools/grumphp/resources/hooks'
git_hook_variables:
EXEC_GRUMPHP_COMMAND: 'docker-compose run -eSYMFONY_DEPRECATIONS_HELPER=disabled=1 php'
tasks:
... I added my custom hooks, this is the #!/bin/sh
DIFF=$(git -c diff.mnemonicprefix=false -c diff.noprefix=false --no-pager diff -r -p -m -M --full-index --no-color --staged | cat)
# Grumphp env vars
$(ENV)
export GRUMPHP_GIT_WORKING_DIR="$(git rev-parse --show-toplevel)"
# Run GrumPHP
(cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}" | $(EXEC_GRUMPHP_COMMAND) $(HOOK_COMMAND) '--ansi' '--skip-success-output' < /dev/tty) |
Hey, I've had the same problem for a few weeks. The trick of adding the I'm investigating to understand what could have caused this and what trick I could find to solve it. If anyone else has had the problem and found another trick, please share it 😄 |
Hey, I didn't find the problem but by switching from version 8.1.25 to version 8.3.9 of PHP, I no longer have the problem |
Hi,
To this:
Thanks and have a nice day. |
Hello, |
I would like to fix the coding standard issues interactively by answering the question 'I can fix some stuff automatically, do you want me to? (yes/no) [no]:' with yes. However, the terminal prefills the question with % and ends the conversation.
This blog article points explains that the interaction should work as i expect. https://veewee.github.io/blog/let-grumphp-fix-your-code/
My configuration
Steps to reproduce:
Result:
The text was updated successfully, but these errors were encountered: