shpaass / yafc-ce

Powerful Factorio calculator/analyser that works with mods
GNU General Public License v3.0
52 stars 19 forks source link

Investigate git hooks for dotnet format #295

Open shpaass opened 4 days ago

shpaass commented 4 days ago

As someone mentioned recently, it would be good if the dotnet format part of the check was done before the commit is accepted into the PR. That is usually done by git hooks, either on the client or server side. We need to investigate how to set it up.

shpaass commented 1 day ago

https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks I'll make a client-side check.

shpaass commented 1 day ago

Hmm, git doesn't track .git directory, so storing things in .git/hooks is not an option. It seems like we'll need something like a configure.sh script to run git config core.hooksPath .githooks. Git does not set environment variables due to security.

veger commented 1 day ago

Git does not set environment variables due to security.

Indeed, otherwise it would be very easy for you to steal my data, by just having a git hook that zips my disk and send it over to you :wink: Therefore, there is always a manual step needed to activate (local) hooks. (Usually by copying some scrip to the 'installed hooks location').

If you want to force certain tests/checks, they only guaranteed way is to do it server side (in our case with GitHub Actions).