From 3a775ada6560e55897a8075902fcc0c6c0506df0 Mon Sep 17 00:00:00 2001 From: Christina Date: Tue, 8 Nov 2022 12:10:36 -0500 Subject: [PATCH 1/3] Changed .*.py --> *.py to avoid .ipynb files having yapf linting error checks run on them. --- hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index c6332729e..21d8ee91c 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -12,7 +12,7 @@ fi echo "Begin linting step using yapf formatting" linterrorfound=0 -for stagedfile in $(git diff --name-only --cached | grep .*.py) +for stagedfile in $(git diff --name-only --cached | grep *.py) do yapf --diff --style .style.yapf $stagedfile ret=$? From 030f720a56407329d5b83eed0c91e4ae66ac5c59 Mon Sep 17 00:00:00 2001 From: Christina Date: Tue, 8 Nov 2022 19:51:11 -0500 Subject: [PATCH 2/3] Added directions in README_developers.md to uninstall the pre-commit hook --- README_developers.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README_developers.md b/README_developers.md index bdf060dff..754360aba 100644 --- a/README_developers.md +++ b/README_developers.md @@ -142,3 +142,11 @@ If are planning on committing, code and get a linting error. Sometimes the log d yapf --diff --recursive --style .style.yapf qiskit_metal ``` Go to directory with qiskit-metal/.style.yapf file and run the above command to lint locally. This may give more meaningful feedback for linting failure. + +## Uninstall precommit hook + +``` +rm /hooks/pre-commit +``` + +If you need to uninstall the precommit hook, go to the root of the project and run the above command. \ No newline at end of file From 26527f0df832a5c3a3016efcebaf5a5950d9adb7 Mon Sep 17 00:00:00 2001 From: Christina Date: Thu, 10 Nov 2022 19:58:46 -0500 Subject: [PATCH 3/3] Fixed pre-commit hook to catch python files. --- hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index 21d8ee91c..f26347055 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -12,7 +12,7 @@ fi echo "Begin linting step using yapf formatting" linterrorfound=0 -for stagedfile in $(git diff --name-only --cached | grep *.py) +for stagedfile in $(git diff --name-only --cached | grep ".*\.py") do yapf --diff --style .style.yapf $stagedfile ret=$?