From 1327c1cbb2dc0b3068a56119df7838d76ac640d1 Mon Sep 17 00:00:00 2001 From: Siddhant Chaudhary Date: Sat, 2 Sep 2023 13:52:12 +0530 Subject: [PATCH] Adding a custom pre-commit hook, and a new script which sets up the hook. --- .githooks/pre-commit | 1 + dev/Project.toml | 2 ++ dev/setup.jl | 9 +++++++++ 3 files changed, 12 insertions(+) create mode 100644 .githooks/pre-commit create mode 100644 dev/setup.jl diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100644 index 0000000000..8752801247 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1 @@ +julia --color=yes dev/flux_format.jl --verbose . diff --git a/dev/Project.toml b/dev/Project.toml index f3aab8b8bf..24d6711c07 100644 --- a/dev/Project.toml +++ b/dev/Project.toml @@ -1,2 +1,4 @@ [deps] +Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" +Git = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2" JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" diff --git a/dev/setup.jl b/dev/setup.jl new file mode 100644 index 0000000000..baf0efdb15 --- /dev/null +++ b/dev/setup.jl @@ -0,0 +1,9 @@ +# setup the custom git hook +using Git + +# set the local hooks path +const git = Git.git() +run(`$git config --local core.hooksPath .githooks/`) + +# set file permission for hook +Base.Filesystem.chmod(".githooks", 0o777; recursive = true)