mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 11:08:31 +00:00
Add optional git hook to run formatter pre-push.
This commit is contained in:
committed by
Michelle Tang
parent
5e81f9c720
commit
413bdb7b38
1
.gitignore
vendored
1
.gitignore
vendored
@@ -32,3 +32,4 @@ maps.key
|
|||||||
/local/
|
/local/
|
||||||
kls_database.db
|
kls_database.db
|
||||||
.kotlin
|
.kotlin
|
||||||
|
lefthook-local.yml
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ You will need to [sign our CLA](https://signal.org/cla/) before your pull reques
|
|||||||
### Follow the Code Style Guidelines
|
### Follow the Code Style Guidelines
|
||||||
Ensure that your code adheres to the [Code Style Guidelines](https://github.com/signalapp/Signal-Android/wiki/Code-Style-Guidelines) before submitting a pull request.
|
Ensure that your code adheres to the [Code Style Guidelines](https://github.com/signalapp/Signal-Android/wiki/Code-Style-Guidelines) before submitting a pull request.
|
||||||
|
|
||||||
You can run `./gradlew format` to automatically check conformance with some of these guidelines.
|
You can run `./gradlew format` to automatically format your code. See `lefthook.yml` for instructions on how to run this as a git hook.
|
||||||
|
|
||||||
### Submit finished and well-tested pull requests
|
### Submit finished and well-tested pull requests
|
||||||
Please do not submit pull requests that are still a work in progress. Pull requests should be thoroughly tested and ready to merge before they are submitted.
|
Please do not submit pull requests that are still a work in progress. Pull requests should be thoroughly tested and ready to merge before they are submitted.
|
||||||
|
|||||||
15
lefthook.yml
Normal file
15
lefthook.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Lefthook git hooks configuration
|
||||||
|
#
|
||||||
|
# ========== SETUP ==========
|
||||||
|
# 1. Install lefthook: https://lefthook.dev/installation/
|
||||||
|
# 2. Enable hooks: lefthook install
|
||||||
|
#
|
||||||
|
# ========== CUSTOMIZATION ==========
|
||||||
|
# Create lefthook-local.yml (gitignored) to override settings locally.
|
||||||
|
# https://lefthook.dev/examples/lefthook-local.html
|
||||||
|
|
||||||
|
pre-push:
|
||||||
|
commands:
|
||||||
|
format:
|
||||||
|
run: ./gradlew format --quiet && test -z "$(git status --porcelain)"
|
||||||
|
fail_text: "Formatting changes detected. Please commit them and push again."
|
||||||
Reference in New Issue
Block a user