Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: check-executables-have-shebangs
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.6
hooks:
- id: ruff-format
types_or: [python, pyi]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.1
hooks:
- id: clang-format
types_or: [c++, c, cuda]
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.26.0
hooks:
- id: gersemi
- repo: https://github.com/google/go-jsonnet
rev: v0.21.0
hooks:
- id: jsonnet-format
- id: jsonnet-lint
# The files in test/max-parallelism import files that are generated during the build.
# We therefore exclude them from linting, but still format them.
exclude: ^test/max-parallelism
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.1
hooks:
- id: prettier
types_or: [yaml]
16 changes: 16 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,19 @@ The `.github/copilot-instructions.md` contains various "ground rules" to be obse
The instructions in this file were created not by hand, but by asking Copilot to produce instructions for itself to achieve a goal, such as, "Please update the instructions file to ensure adherence to `markdown-lint` rules when generating Markdown files." This way (hopefully), the instructions are more likely to have the intended effect on the AI since they were generated by the AI itself.

If you wish to add your own personalized instructions, or adjust/augment the repository-level instructions via PR, best results will be achieved by following this method rather than writing them yourself except in the most trivial of cases.

## Pre-commit

The tool pre-commit offers a framework for setting up hooks that are run on staged files before committing, ensuring correct formatting and catching some errors before they end up in a commit.

To set up this tool locally, first install `pre-commit` (or `prek`, a faster re-implementation in rust) using your system package manager or `uv`/`pip(x)`, e.g. `uv tool install pre-commit`.

So set up the hooks in the Phlex repository, run the `pre-commit install` command once in the repository. The hooks now should run automatically prior to each commit.

To skip a check temporarily, run `SKIP=ruff-format git commit -m "...". To skip all hooks, you can use the `--no-verify` flag to `git commit`.

To manually run hooks over all files, run `pre-commit run --all-files`.

The pre-commit hooks are configured in `.pre-commit-config.yaml`.

For further reference, see the extensive [pre-commit documentation](https://pre-commit.com/).
Loading