Add common githooks folder to share hooks with the team #1349
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Task/Issue URL: https://app.asana.com/0/414730916066338/1200701185339027/f
Tech Design URL:
CC:
Description:
This PR adds a
.githooksfolder where all commit hooks we think should be shared across the devs should be placed, and adds the first hook which runs spotless on all modules for every commit to ensure our code styling is always correct.Unfortunatelly GIT does not allow to directly check-in the hooks in the
.git/hooksdirectory. Also anything in those folders are not cloned. The rational seems to be that a clone repository is a local copy, so sharing the hooks would go against that de-centralised approach.However, it is possible to share a folder where we can place those hooks, ie.
.githooksand then tell git where it needs to look for them. The downside is that we are adding a config step but that should be ok.The setup for a newcomer to the repo would be:
git config core.hooksPath .githooksFrom that point forward, git will look into
.githooksrather than.git/hooksSteps to test this PR:
git config core.hooksPath .githooksFeedActivityline 141{insupportFragmentManager.transaction {git commit -a -m testAppUrlline 19{inclass AppUrl {git commit -a -m test2Internal references:
Software Engineering Expectations
Technical Design Template