apache / apache/gravitino

[FEATURE] Use git hooks to auto apply or check for common issues before commit or push

Open
#2,175 1 comment 0 reactions 0 assignees View on GitHub
feature
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 16h
Merged PRs (30d)
298

Description

### Describe the feature

We can utilize git hooks to improve developer experience. Git hooks are scripts that are run at various event in git such as `commit` & `push`. We make use of these hooks to automate certain tasks or add checks. We can add auto format before commit, check to make sure our commit message are following guidelines outlined by [common conventions](https://www.conventionalcommits.org/en/v1.0.0/#summary), run errorprone or add a security scan. These are few of the many many ways we can use git hooks to our advantage.

Adding git hooks can maintainers not get overwhelmed with notification or failed pipelines and save on cost by not having to rerun runner with each new commit(eco friendly :recycle:).

### Motivation

Formatting is annoying, running `errorprone` as part of `pre-push` can help us reduce new issues introduced.

### Describe the solution

We can use either a tool like `precommit` or simply add our hooks in `.git/hooks/`. [How?](https://www.viget.com/articles/two-ways-to-share-git-hooks-with-your-team/)

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the proposed options, including a precommit tool versus shared scripts under .git/hooks/, and determine which checks are in scope. The issue is done when the project has an agreed hook approach covering the selected formatting, commit-message, errorprone, or security checks and its use is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.