Skip to content

Pre-commit Hooks

Ireul exposes lint hooks via .pre-commit-hooks.yaml. Repos reference Ireul as a remote pre-commit repository and pin to a version tag for reproducible behaviour.


Setup

Add Ireul to .pre-commit-config.yaml in your repo. Set rev to the current PLATFORM_VERSION.

# Reference Ireul as a remote hook source; pin rev to PLATFORM_VERSION for reproducible lint behaviour across environments
repos:
  - repo: https://github.com/rtsko/ireul
    rev: v0.1.0
    hooks:
      - id: ruff-lint
      - id: ruff-format
      - id: yamllint

Install the hooks into the local git repo:

# Install all hooks defined in .pre-commit-config.yaml into the repository's git hooks directory
pre-commit install

Available hooks

Hook ID Tool Version Targets
ruff-lint ruff check pinned in hook definition Python files
ruff-format ruff format --check pinned in hook definition Python files
yamllint yamllint pinned in hook definition YAML files

Tool versions are pinned via additional_dependencies in .pre-commit-hooks.yaml. The version in versions.yml is the authoritative source; .pre-commit-hooks.yaml must match it.


Lint configuration

Hooks invoke the tools without a --config argument. Each tool finds its config by walking up the directory tree from the files being linted, following each tool's standard resolution order:

Tool Config file Location
ruff ruff.toml or pyproject.toml Repo root or lint/
yamllint .yamllint.yml or .yamllint Repo root

Copy the reference configs from Ireul's lint/ directory into your repo on onboarding. See Onboarding for the full setup sequence.


Running manually

# Run all configured hooks against every file in the repository, not just staged changes
pre-commit run --all-files
# Run a single hook by ID against all files for targeted debugging or one-off checks
pre-commit run ruff-lint --all-files

Upgrading

When a new Ireul tag is released, update rev: in .pre-commit-config.yaml to the new tag, then run:

# Reinstall hook environments after changing the rev to pull updated hook dependencies
pre-commit install --overwrite

Test against the full repo before committing the version bump:

# Verify all hooks pass against the full codebase before merging a PLATFORM_VERSION upgrade
pre-commit run --all-files