Guest User

Untitled

a guest
Jul 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # blacken the staged files
  4. for file in $(git diff --cached --name-only | grep -E '\.(py)$')
  5. do
  6. black "$file"
  7. $(git add "$file")
  8. done
  9.  
  10. for file in $(git diff --cached --name-only | grep -E '\.(py)$')
  11. do
  12. flake8 "$file"
  13. if [ $? -ne 0 ]; then
  14. echo "flake8 failed on staged file '$file'. Please check your code and try again. To check output manually run flake8 $file"
  15. exit 1 # exit with failure status
  16. fi
  17. done
Add Comment
Please, Sign In to add comment