Skip to content

Instantly share code, notes, and snippets.

@shapiromatron
Created January 20, 2018 04:41
Show Gist options
  • Select an option

  • Save shapiromatron/4f6311b9edae8d3c1d13e991dc695dba to your computer and use it in GitHub Desktop.

Select an option

Save shapiromatron/4f6311b9edae8d3c1d13e991dc695dba to your computer and use it in GitHub Desktop.
pre-commit python linting

Globally add pre-commit hooks on all user's computers. Use prettier to automatically clean JS/CSS code, and throw errors for python code which doesn't meet flake8 rules.

One problem is flake8 needs to be available in the pre-commit path, which without adding globally I struggled with...

{
"scripts": {
"precommit": "lint-staged"
},
"lint-staged": {
"*.{js,json,css}": ["prettier --write", "git add"],
"*.py": "flake8"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment