From 3b8972ce1faba5ed3e402283ba1539f799b43077 Mon Sep 17 00:00:00 2001 From: lanvent Date: Mon, 17 Apr 2023 00:57:48 +0800 Subject: [PATCH] add pre-commit hook --- .flake8 | 13 +++++++++++++ .pre-commit-config.yaml | 29 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .flake8 create mode 100644 .pre-commit-config.yaml diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..c614a63 --- /dev/null +++ b/.flake8 @@ -0,0 +1,13 @@ +[flake8] +max-line-length = 88 +select = E303,W293,W291,W292,E305,E231,E302 +exclude = + .tox, + __pycache__, + *.pyc, + .env + venv/* + .venv/* + reports/* + dist/* + lib/* \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b6c6e19 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,29 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: fix-byte-order-marker + - id: check-case-conflict + - id: check-merge-conflict + - id: debug-statements + - id: pretty-format-json + types: [text] + files: \.json(.template)?$ + args: [ --autofix , --no-ensure-ascii, --indent=2, --no-sort-keys] + - id: trailing-whitespace + exclude: '(\/|^)lib\/' + args: [ --markdown-linebreak-ext=md ] + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + exclude: '(\/|^)lib\/' + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black + exclude: '(\/|^)lib\/' + - repo: https://github.com/PyCQA/flake8 + rev: 6.0.0 + hooks: + - id: flake8