I am sure it is a repeated question and apologies to bother. I didn't find solution to my usecase yet. I created a pre-commit hook that prevents commit when newly developed code has sonar issues. Since it is a pre-commit hook there might be a chance that developer can disable this hook using --no-verify
option and I want to avoid it.
NOTE: I can't use pre-receive hook in this usecase because newly developed code will be on developer's machine and hence the hook should be triggered as client-side hook.
Is there anyway to enforce this hook to be executed before commit (out of developer control) without skipping it? I found a similar stack overflow question where the answers suggests to use pre-receive hook which works on push event not on commit event. Now I just want to run pre-commit hook without developer control. If this is not possible, Is there any alternative? so that I can confirm the hook execution before pushing the code.
I know that --no-verify
option is git internal command and we have less chances to control it. I want to know if pre-receive hook can help me in ensuring the execution of pre-commit hook before push event.
Thanks in advance