From 10123851fff18793b53d61fa6b074b566badb7c2 Mon Sep 17 00:00:00 2001 From: caelansar <819711623@qq.com> Date: Mon, 29 Apr 2024 22:53:40 +0800 Subject: [PATCH] chore: pre-commit --- .pre-commit-config.yaml | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 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 0000000..82d381c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,47 @@ +fail_fast: false +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-byte-order-marker + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + - repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black + - repo: local + hooks: + - id: cargo-fmt + name: cargo fmt + description: Format files with rustfmt. + entry: bash -c 'cargo fmt -- --check' + language: rust + files: \.rs$ + args: [] + - id: cargo-check + name: cargo check + description: Check the package for errors. + entry: bash -c 'cargo check --all' + language: rust + files: \.rs$ + pass_filenames: false + - id: cargo-clippy + name: cargo clippy + description: Lint rust sources + entry: bash -c 'cargo clippy --all-features -- -D warnings' + language: rust + files: \.rs$ + pass_filenames: false + - id: cargo-test + name: cargo test + description: unit test for the project + entry: bash -c 'cargo nextest run --all-features' + language: rust + files: \.rs$ + pass_filenames: false