From 56ae937a079a0654c3a7d0516fdc2f32e162c57b Mon Sep 17 00:00:00 2001 From: hongjiongteng Date: Sat, 22 Jul 2023 11:57:45 +0800 Subject: [PATCH] Add .pre-commit-config.yaml to automatically detect code issues when git commit --- .pre-commit-config.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..7684516ba --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,22 @@ +# Install +# 1. pip install pre-commit +# 2. pre-commit install(the first time you download the repo, it will be cached for future use) +repos: + - repo: https://github.com/pycqa/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + args: [ + "--show-source", + "--count", + "--statistics", + "--extend-ignore=E203,E402,C901,E501,E101,E266,E731,W291,F821,W191", + "--per-file-ignores=__init__.py:F401", + ] # when necessary, ignore errors, https://flake8.pycqa.org/en/latest/user/error-codes.html + exclude: ^venv/ # exclude dir, e.g. (^foo/|^bar/) + + - repo: https://github.com/pycqa/isort + rev: 5.11.5 + hooks: + - id: isort + args: ['--profile', 'black']