Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Need Git pre-commit validation #8

Open
mukeshsah08 opened this issue Sep 21, 2021 · 2 comments
Open

Need Git pre-commit validation #8

mukeshsah08 opened this issue Sep 21, 2021 · 2 comments

Comments

@mukeshsah08
Copy link

No description provided.

@mukeshsah08
Copy link
Author

mukeshsah08 commented Sep 21, 2021

I have tried to override the pre-commit script to check the blt phpcs in a project. But it's not working.
Directory path: Project Root->blt->scripts->git-hooks->pre-commit

#!/usr/bin/env bash

ROOT_DIR="$(pwd)/"
LIST=$( git diff --name-only --cached --diff-filter=ACM )

echo "Executing phpcs .git/hooks/pre-commit..."
git diff-index --quiet HEAD -- || echo "Untracked files are present, this may impact the validity of pre-commit checks."
"${ROOT_DIR}"/vendor/bin/blt validate:phpcs "${LIST}"

# Return the status of the last run command.
exit $?

@sharique
Copy link

This is code from 11.x branch https://github.com/acquia/blt/blob/11.x/src/Robo/Commands/Internal/GitCommand.php#L66, where it runs phpcs in pre-commit hook.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants