From 2ca1e9bbaa7ea65f949f18d0ecc68e89e5ab8961 Mon Sep 17 00:00:00 2001 From: Leo Lu Date: Tue, 14 Mar 2023 20:21:57 +0800 Subject: [PATCH 1/3] Change language to rust to let pre-commit bootstrap rust Add an empty cargo.toml to fool the build system --- .gitignore | 1 + .pre-commit-hooks.yaml | 6 +++--- Cargo.toml | 8 ++++++++ src/main.rs | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index d2d2d13..e10553c 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -2,21 +2,21 @@ name: cargo fmt description: Format files with cargo fmt. entry: cargo fmt - language: system + language: rust types: [rust] args: ["--"] - id: cargo-check name: cargo check description: Check the package for errors. entry: cargo check - language: system + language: rust types: [rust] pass_filenames: false - id: cargo-clippy name: cargo clippy description: Lint Rust sources with Clippy. entry: cargo clippy - language: system + language: rust args: ["--", "-D", "warnings"] types: [rust] pass_filenames: false diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..14caf07 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "pre-commit-rust" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} From 0e2902fb45f992935ef2d526529ba5b261801259 Mon Sep 17 00:00:00 2001 From: Leo Lu Date: Tue, 14 Mar 2023 20:32:49 +0800 Subject: [PATCH 2/3] Add description --- Cargo.toml | 1 + src/main.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 14caf07..1740ab9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "pre-commit-rust" version = "0.1.0" edition = "2021" +description = "Dummy cargo repo to ask pre-commit install cargo." # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index e7a11a9..9f11e8d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,3 @@ fn main() { - println!("Hello, world!"); + println!("This is only a placeholder."); } From 5270a570a2f892051457cc9c7a33bf77b25a90a3 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Wed, 11 Dec 2024 16:06:29 -0500 Subject: [PATCH 3/3] cargo test hook is also Rust, not system --- .pre-commit-hooks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index e10553c..0695846 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -24,6 +24,6 @@ name: cargo test description: Run tests entry: cargo test - language: system + language: rust types: [rust] pass_filenames: false