Skip to content

Commit

Permalink
874 pre commit hook (#875)
Browse files Browse the repository at this point in the history
* Changed .*.py --> *.py to avoid .ipynb files having yapf linting error checks run on them.

* Added directions in README_developers.md to uninstall the pre-commit hook

Co-authored-by: Priti Ashvin Shah <74020801+priti-ashvin-shah-ibm@users.noreply.github.com>
  • Loading branch information
cdelnano and priti-ashvin-shah-ibm authored Nov 9, 2022
1 parent c798b9d commit 39313b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README_developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down

0 comments on commit 39313b1

Please sign in to comment.