From da4ec895fc97bf2e6fde18eb60ab84b4d5d4d499 Mon Sep 17 00:00:00 2001 From: user01 Date: Wed, 6 Dec 2023 21:15:41 +0800 Subject: [PATCH] [lint] use pre-commit to auto check and lint --- .pre-commit-config.yaml | 18 ++++++++++++++++++ README.md | 1 + requirements.txt | 1 + 3 files changed, 20 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 00000000..8fa9369d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - repo: https://github.com/pycqa/flake8 + rev: '3.8.2' + hooks: + - id: flake8 + - repo: https://github.com/pre-commit/mirrors-yapf + rev: 'v0.32.0' + hooks: + - id: yapf + - repo: https://gitlab.com/daverona/pre-commit/cpp + rev: '0.8.0' + hooks: + - id: cpplint + - id: clang-format diff --git a/README.md b/README.md index d0899a3d..10996a1f 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ conda create -n wespeaker python=3.9 conda activate wespeaker conda install pytorch=1.12.1 torchaudio=0.12.1 cudatoolkit=11.3 -c pytorch -c conda-forge pip install -r requirements.txt +pre-commit install # for clean and tidy code ``` ## 🔥 News diff --git a/requirements.txt b/requirements.txt index 364ae9bd..01978e7a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,3 +22,4 @@ onnxruntime soundfile==0.10.3.post1 pypeln==0.4.9 silero-vad @ git+https://github.com/pengzhendong/silero-vad.git +pre-commit==3.5.0