Skip to content

Instantly share code, notes, and snippets.

@annarailton
Last active July 25, 2019 11:39
Show Gist options
  • Save annarailton/0325f2de94ad9a3f777c3d7e62b9024a to your computer and use it in GitHub Desktop.
Save annarailton/0325f2de94ad9a3f777c3d7e62b9024a to your computer and use it in GitHub Desktop.
Config for https://pre-commit.com framework
default_language_version:
python: python3.7
default_stages: [commit, push]
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-json
- id: check-yaml
- id: pretty-format-json
args: ['--autofix']
- id: detect-private-key
- id: check-ast
- id: check-docstring-first
- id: trailing-whitespace
- id: double-quote-string-fixer
- repo: https://github.com/annarailton/mirrors-autoflake.git
rev: v1.1
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports']
# Format docstrings
- repo: https://github.com/annarailton/docformatter
rev: 23d96adf42b094f1874ce9bb2815c5d35b8f2dba
hooks:
- id: docformatter
# Reformat all the things
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.28.0
hooks:
- id: yapf
# Run flake8 last so you don't pick up the stuff you just fixed
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: flake8
additional_dependencies: [
'flake8-blind-except',
'flake8-commas',
'flake8-comprehensions',
'flake8-deprecated',
'flake8-mutable',
'flake8-pep3101',
'flake8-quotes',
'flake8-string-format',
'flake8-tidy-imports',
'flake8-todo',
]
args: ['--ignore=C819,P1,P2,E251,W504'] # valid E251 caught by yapf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment