From 6db38901bffc81937d13587b005a90928b5291c8 Mon Sep 17 00:00:00 2001 From: Mathieu Lemay Date: Sun, 12 Jan 2020 16:02:48 -0500 Subject: [PATCH 1/4] Use cargo fmt instead of rustfmt --- .pre-commit-hooks.yaml | 4 ++-- hooks.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 80b7c98..2c15f3a 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,7 +1,7 @@ - id: fmt name: fmt - description: Format files with rustfmt. - entry: rustfmt -- + description: Format files with cargo fmt. + entry: cargo fmt -- language: system files: \.rs$ args: [] diff --git a/hooks.yaml b/hooks.yaml index 22bec7d..ca02623 100644 --- a/hooks.yaml +++ b/hooks.yaml @@ -1,7 +1,7 @@ - id: fmt name: fmt - description: Format files with rustfmt. - entry: rustfmt -- + description: Format files with cargo fmt. + entry: cargo fmt -- language: system files: \.rs$ args: [] From 257c8ca7b4502d8dc7467b644fb85c5fc3836972 Mon Sep 17 00:00:00 2001 From: Mathieu Lemay Date: Sun, 12 Jan 2020 16:03:33 -0500 Subject: [PATCH 2/4] Use `types` instead of `files` --- .pre-commit-hooks.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 2c15f3a..9ddb1e1 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -3,19 +3,19 @@ description: Format files with cargo fmt. entry: cargo fmt -- language: system - files: \.rs$ + types: [rust] args: [] - id: cargo-check name: cargo check description: Check the package for errors. entry: cargo check language: system - files: \.rs$ + types: [rust] pass_filenames: false - id: clippy name: clippy description: Lint rust sources entry: cargo clippy -- -D warnings language: system - files: \.rs$ + types: [rust] pass_filenames: false From 4bb2cb56a19f1f12165d1dfd9b53697034001e09 Mon Sep 17 00:00:00 2001 From: Mathieu Lemay Date: Tue, 7 Apr 2020 10:34:50 -0400 Subject: [PATCH 3/4] Allow user to send args to cargo fmt, not just to rustfmt --- .pre-commit-hooks.yaml | 2 +- hooks.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 9ddb1e1..ac6f286 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,7 +1,7 @@ - id: fmt name: fmt description: Format files with cargo fmt. - entry: cargo fmt -- + entry: cargo fmt language: system types: [rust] args: [] diff --git a/hooks.yaml b/hooks.yaml index ca02623..dd89e3a 100644 --- a/hooks.yaml +++ b/hooks.yaml @@ -1,7 +1,7 @@ - id: fmt name: fmt description: Format files with cargo fmt. - entry: cargo fmt -- + entry: cargo fmt language: system files: \.rs$ args: [] From 84b3445a55f873ed725fac8a32cc11e9760dc288 Mon Sep 17 00:00:00 2001 From: Mathieu Lemay Date: Thu, 30 Apr 2020 21:11:24 -0400 Subject: [PATCH 4/4] Revert "Allow user to send args to cargo fmt, not just to rustfmt" This actually broke the hook. The -- needs to be present for pre-commit to be able to pass the file names to run the hook on. This reverts commit 4bb2cb56a19f1f12165d1dfd9b53697034001e09. --- .pre-commit-hooks.yaml | 2 +- hooks.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index ac6f286..9ddb1e1 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,7 +1,7 @@ - id: fmt name: fmt description: Format files with cargo fmt. - entry: cargo fmt + entry: cargo fmt -- language: system types: [rust] args: [] diff --git a/hooks.yaml b/hooks.yaml index dd89e3a..ca02623 100644 --- a/hooks.yaml +++ b/hooks.yaml @@ -1,7 +1,7 @@ - id: fmt name: fmt description: Format files with cargo fmt. - entry: cargo fmt + entry: cargo fmt -- language: system files: \.rs$ args: []