Skip to content

Commit be3cc87

Browse files
committed
Address review add code comments about priority levels
1 parent b09664b commit be3cc87

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@
1616
# under the License.
1717

1818
---
19+
# prek-style priority keys enables prek to run independent hooks in parallel, improving pre-commit check times.
20+
# The priority values are assigned to structure the hook execution into logical stages, ensuring correct ordering of
21+
# file modifications and maximum concurrency of read-only checks.
22+
23+
# Priority Levels: Hooks can be assigned different priority numbers. Hooks with a priority of 0 (or a higher numerical
24+
# value, depending on configuration) run first or alongside other zero-priority hooks to decrease total end-to-end
25+
# execution time.
26+
27+
# Priority Groups and Ordering Design
28+
29+
# | Stage / Priority | Hooks | Rationale |
30+
# |---|---|---|
31+
# | **Priority 10** | `identity`, `check-hooks-apply` | **Meta & Setup**: Ensure environment is valid before executing heavy checks. |
32+
# | **Priority 20** | `fix-byte-order-marker` | **File Cleanups (Broad)**: Fix BOM first so subsequent steps work with clean UTF-8 text. |
33+
# | **Priority 30** | `trailing-whitespace` | **Formatting (Broad)**: Cleans up whitespace on files before other hooks validate them. |
34+
# | **Priority 40** | `doctoc`, `oxipng`, `file-contents-sorter` | **Disjoint Modifiers**: These modify different sets of files (`README.md`, `.png` files, and `codespell.txt` respectively). Running them concurrently is safe. |
35+
# | **Priority 50** | `codespell`, `check-ast`, `check-builtin-literals`, `check-case-conflict`, `check-executables-have-shebangs`, `check-illegal-windows-names`, `check-json`, `check-merge-conflict`, `check-vcs-permalinks`, `check-xml`, `check-yaml`, `debug-statements`, `detect-aws-credentials`, `detect-private-key`, `forbid-submodules`, `gitleaks`, `bandit`|
36+
# | | **Read-Only / Syntax / Security**: The bulk of the suite. These hooks only read and validate files without modifying them, allowing full parallel execution. |
37+
1938
# https://prek.j178.dev/installation/
2039
default_stages: [pre-commit, pre-push]
2140
default_language_version:

0 commit comments

Comments
 (0)