Skip to content

Apache Lucene open-source search software

docs: improve precommit documentation (#15765)

Robert Muir8d8c3862fe70
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8fab9446449..cf0c952d3a1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -50,6 +50,8 @@ various parts of the build system, including typical workflow tasks.
### Code formatting and checks
+Lucene uses [prek](https://github.com/j178/prek) for fast pre-commit validation. Validate your staged changes with `uvx prek`, Type `./gradlew helpPrecommit` for more information: [help/precommit.txt](help/precommit.txt).
+
If you've modified any sources, run `./gradlew tidy` to apply code formatting conventions automatically (see [help/formatting.txt](https://github.com/apache/lucene/blob/main/help/formatting.txt)).
Please make sure that all unit tests and validations succeed before constructing your patch: `./gradlew check`. This will assemble Lucene and run all validation tasks (including tests). There are various commands to check the code; type `./gradlew helpTest` for more information ([help/tests.txt](./help/tests.txt)).
diff --git a/help/precommit.txt b/help/precommit.txt
index 22f1275e908..5bb7413069c 100644
--- a/help/precommit.txt
+++ b/help/precommit.txt
@@ -13,7 +13,8 @@ uvx prek
To install a precommit hook so this happens automatically:
-uvx prek install
+uv tool install prek
+prek install
To exhaustively force-check all files (like CI does):
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index ff587a512d2..4cf189855e0 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -175,7 +175,7 @@ Build
* GITHUB#15629: Introduce prek for fast pre-commit/repository checks.
Markdown files are now linted with local broken-link detection.
Python and Shell scripts are now linted system-wide.
- Install with `uvx prek install`
+ Install with `uv tool install prek; prek install`
For more see help/precommit.txt or `./gradlew helpPrecommit` (Robert Muir)
Other