加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.pre-commit-config.yaml 3.83 KB
一键复制 编辑 原始数据 按行查看 历史
# See https://pre-commit.com for more information
# NOTE: must run:
# pip install pre-commit
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# cargo install cargo-machete --locked
# cargo install cargo-deny --locked
# pre-commit install --hook-type pre-commit
# pre-commit install --hook-type pre-push
default_install_hook_types:
- pre-commit
- pre-push
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-added-large-files
stages: [commit, push]
- id: check-merge-conflict
args: ["--assume-in-merge"]
stages: [commit, push]
- id: check-symlinks
stages: [commit, push]
- id: check-toml
stages: [commit, push]
- id: check-yaml
args: ["--allow-multiple-documents"]
stages: [commit, push]
- id: trailing-whitespace
stages: [commit, push]
- repo: local
hooks:
# NOTE: if a false positive occurs and dependency is used that cargo-machete complains about,
# you can ignore it by adding this field in the package's Cargo.toml:
# [package.metadata.cargo-machete]
# ignored = []
- id: cargo-machete
name: cargo-machete
description: list unused cargo dependencies
stages: [commit, push]
entry: cargo
args:
- machete
language: system
types: [file]
files: (\.rs|Cargo\.toml)$
pass_filenames: false
- id: cargo-deny
name: cargo-deny
description: Cargo plugin for linting your dependencies
stages: [commit, push]
entry: cargo
args:
- deny
- check
language: system
types: [file]
files: Cargo\.toml$
pass_filenames: false
- id: cargo-clippy
name: cargo-clippy
description: lint the minimal changed packages in the cargo workspace
stages: [commit]
entry: cargo
args:
- clippy
- --verbose
- --all-features
- --fix
- --allow-dirty
- --allow-staged
language: system
types: [file]
files: (\.rs|Cargo\.toml)$
pass_filenames: false
- id: cargo-clippy
name: cargo-clippy
description: lint the minimal changed packages in the cargo workspace
stages: [push]
entry: cargo
args:
- clippy
- --verbose
- --all-features
- --
- -D
- warnings
language: system
types: [file]
files: (\.rs|Cargo\.toml)$
pass_filenames: false
- id: cargo-fmt
name: cargo-fmt
description: format files with cargo fmt
stages: [commit, push]
entry: cargo fmt
language: system
types: [rust]
args: ["--"]
- id: cargo-doc
name: cargo-doc
description: ensure cargo doc builds
stages: [push]
entry: sh
args:
- -c
- "RUSTDOCFLAGS=\"-D warnings\" cargo doc --all-features"
language: system
types: [file]
files: (\.md|\.rs|Cargo\.toml)$
exclude: (CHANGELOG|DEVELOPMENT)\.md$
pass_filenames: false
- id: cargo-test
name: cargo-test
description: run all tests
stages: [push]
entry: sh
args:
- -c
- |
CARGO_INCREMENTAL="0" \
RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests" \
RUSTDOCFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests" \
cargo test \
--all-features
language: system
types: [file]
files: (\.md|\.rs|Cargo\.toml)$
exclude: (CHANGELOG|DEVELOPMENT)\.md$
pass_filenames: false
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化