diff options
author | Jan Willhaus <mail@janwillhaus.de> | 2019-05-19 18:46:17 +0200 |
---|---|---|
committer | Jan Willhaus <mail@janwillhaus.de> | 2019-11-02 16:05:15 +0100 |
commit | c2e1b4c4f8f2f7617a9429518483e1820bdc7e91 (patch) | |
tree | 4cb27d3e6094ad2291e50ee640ec55c239e0197c | |
parent | 2274933a3b5d4fece228c09e756e992883d26e6a (diff) | |
download | warlock-c2e1b4c4f8f2f7617a9429518483e1820bdc7e91.tar.gz |
Add pre-commit framework config, use in linting CI stage
-rw-r--r-- | .pre-commit-config.yaml | 46 | ||||
-rw-r--r-- | .travis.yml | 11 | ||||
-rw-r--r-- | pyproject.toml | 4 |
3 files changed, 58 insertions, 3 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..22c0862 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,46 @@ +default_language_version: + python: python3.7 + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v2.4.0" + hooks: + # General file-formatting + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: end-of-file-fixer + - id: check-json + - id: check-toml + + # Python-related + - id: debug-statements + - id: name-tests-test + args: ["--django"] # Required to match on test*.py + + # Git-related + - id: no-commit-to-branch + - id: check-merge-conflict + + - repo: https://gitlab.com/pycqa/flake8 + rev: "3.7.9" + hooks: + - id: flake8 + additional_dependencies: + - flake8-bugbear # Finds common application design anti-patterns + + - repo: https://github.com/pre-commit/pygrep-hooks + rev: "v1.4.2" + hooks: + - id: python-check-blanket-noqa + + - repo: https://github.com/pre-commit/mirrors-isort + rev: "v4.3.21" + hooks: + - id: isort + additional_dependencies: + - toml # Required for loading config from pyproject.toml + + - repo: https://github.com/ambv/black + rev: "19.10b0" + hooks: + - id: black diff --git a/.travis.yml b/.travis.yml index 3e8aca4..68ef451 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,12 @@ jobs: python: 3.7 dist: xenial install: - - pip install -U black flake8 flake8-bugbear flake8-todo + - pip install -U pre-commit script: - - black --check --verbose . - - flake8 warlock + - pre-commit run --all-files --verbose + env: + - PRE_COMMIT_HOME="$HOME/.cache/pre-commit" + cache: + pip: true + directories: + - "$PRE_COMMIT_HOME" diff --git a/pyproject.toml b/pyproject.toml index 1450944..ebd4bff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,10 @@ exclude = ''' )/ ''' +[tool.isort] +known_third_party = ["jsonpatch","jsonschema","six"] +known_first_party=["warlock"] + [build-system] requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api" |