From 425401430f5550ee012547e3ef6970bbd0a9263e Mon Sep 17 00:00:00 2001 From: Anton Engelhardt Date: Fri, 24 May 2024 20:57:20 +0200 Subject: [PATCH] chore(git): add git hooks Signed-off-by: Anton Engelhardt --- .pre-commit-config.yaml | 23 ++++++++++++++++++++++- .pre-commit-hooks.yaml | 22 ++++++++++++++++++++++ Cargo.toml | 6 +++--- README.md | 2 ++ 4 files changed, 49 insertions(+), 4 deletions(-) mode change 100644 => 100755 .pre-commit-config.yaml create mode 100755 .pre-commit-hooks.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml old mode 100644 new mode 100755 index c9528f47..11e34b5e --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,26 @@ repos: - repo: https://github.com/gitleaks/gitleaks - rev: v8.16.1 + rev: v8.18.2 hooks: - id: gitleaks + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.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/pre-commit/pre-commit + rev: v3.7.1 + hooks: + - id: validate_manifest + - repo: https://github.com/antonengelhardt/wasm-oidc-plugin + rev: v0.4.6 + hooks: + - id: fmt + - id: clippy + - id: cargo-check diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100755 index 00000000..0ffe38d8 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,22 @@ +- id: fmt + name: fmt + description: Format files with cargo fmt. + entry: cargo fmt + language: system + types: [rust] + args: ["--"] +- id: cargo-check + name: cargo check + description: Check the package for errors. + entry: cargo check + language: system + types: [rust] + pass_filenames: false +- id: clippy + name: clippy + description: Lint rust sources + entry: cargo clippy + language: system + args: ["--", "-D", "warnings"] + types: [rust] + pass_filenames: false diff --git a/Cargo.toml b/Cargo.toml index ee0bf4a8..d91c007a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,9 +17,9 @@ log = "0.4.22" # proxy-wasm proxy-wasm = "0.2.2" -# json, yaml, url parsing -url = { version = "2.5.2", features = ["serde"] } -serde = { version = "1.0.204", features = ["derive"] } +# parsing +url = { version = "2.5.0", features = ["serde"] } +serde = { version = "1.0.202", features = ["derive"] } serde_yaml = "0.9.33" serde_json = "1.0.120" serde_urlencoded = "0.7.1" diff --git a/README.md b/README.md index 280f76cb..fbf345ac 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,8 @@ If you want to install a pre-commit hook - you should - install [pre-commit](htt pre-commit install ``` +The pre-commit hook will also check for a clean code style, formatting best practices and enforce clippy lints. + ### Cargo-Deny Cargo-deny checks all dependencies for security vulnerabilities and license issues.