Skip to content

Instantly share code, notes, and snippets.

@andyreagan
Created July 14, 2020 03:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andyreagan/a3294561f3beff8a3622cfeee245b094 to your computer and use it in GitHub Desktop.
Save andyreagan/a3294561f3beff8a3622cfeee245b094 to your computer and use it in GitHub Desktop.
Standard pre commit and isort, flake8 settings
[flake8]
max-line-length = 88
max-complexity = 12
select = C,E,F,W,B,B950
ignore = E203, E501, W503
[settings]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=80
known_third_party=
known_first_party=
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: end-of-file-fixer
language_version: python3.5
stages: [commit, push]
- id: trailing-whitespace
language_version: python3.5
args: [--markdown-linebreak-ext=md]
stages: [commit, push]
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
language_version: python3.5
stages: [commit, push]
- repo: https://github.com/python/black
rev: 19.10b0
hooks:
- id: black
language_version: python3.6
args: [--line-length=80]
stages: [commit, push]
# Lint Python and Pass/Fail
# - repo: https://github.com/PyCQA/pydocstyle
# rev: 4.0.1
# hooks:
# - id: pydocstyle
# language_version: python3.5
# stages: [commit, push]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: check-byte-order-marker
language_version: python3.5
stages: [commit, push]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
language_version: python3.5
args: [--max-line-length=88]
stages: [commit, push]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.740
hooks:
- id: mypy
language_version: python3.5
stages: [commit, push]
# Other Linters
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.18.0
hooks:
- id: yamllint
args: ["-d {extends: relaxed, rules: {line-length: {max: 120}}}"]
stages: [commit, push]
- repo: https://github.com/pryorda/dockerfilelint-precommit-hooks
rev: v0.1.0
hooks:
- id: dockerfilelint
stages: [commit, push]
- repo: local
hooks:
- id: rtestthat
name: rtestthat
entry: /usr/bin/make test
language: script
pass_filenames: false
# alternatively you could `types: [r]` so it only runs when r files change
# though tests might be invalidated if you were to say change a data file
always_run: true
...
test:
Rscript -e 'source("tests/testthat.R")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment