Skip to content

Add pre-commit hooks and run them from format.sh#137

Open
hannahli-nv wants to merge 1 commit into
mainfrom
add-pre-commit-hooks
Open

Add pre-commit hooks and run them from format.sh#137
hannahli-nv wants to merge 1 commit into
mainfrom
add-pre-commit-hooks

Conversation

@hannahli-nv
Copy link
Copy Markdown
Collaborator

Summary

Adds pre-commit hooks to TileGym and wires them into format.sh, so contributors get consistent formatting on all file types (not just Python).

What's included

  • .pre-commit-config.yaml — hooks:
    • trailing-whitespace, end-of-file-fixer (all text files)
    • check-yaml, check-json, pretty-format-json (--indent=2)
    • check-added-large-files
    • ruff-check (--fix) and ruff-format (Python), pinned to ruff 0.14.9 to match format.sh
  • .github/workflows/pre-commit.yml — CI gate that runs the hooks on the files changed by each PR (so existing files aren't retroactively reformatted; only new/changed files are checked).
  • format.sh — now installs and runs the pre-commit hooks before the existing SPDX-header and ruff steps, so bash format.sh applies everything in one command.

Why

ruff only formats/lints Python. Markdown, JSON, and YAML files currently have no automated formatting gate, so things like trailing whitespace, missing final newlines, or unsorted JSON can slip in. These hooks close that gap.

Note on skills/

Skill content under skills/ is excluded from the hooks. Each skill ships a signed skill.oms.sig; reformatting those files would invalidate the signature. Skills are validated and signed by the NVSkills pipeline, not hand-formatted.

CI Configuration

config:
  build: true
  # valid options are "ops" and "benchmark"
  test: []

Introduce a pre-commit configuration (whitespace, end-of-file, YAML/JSON
validation, JSON pretty-format, and ruff lint/format) and a CI workflow that
runs the hooks on the files changed by each pull request.

format.sh now installs and runs the pre-commit hooks before the existing SPDX
header and ruff steps, so 'bash format.sh' applies the full set of checks
locally in one command.

Skill content under skills/ is excluded from the hooks: each skill ships a
signed skill.oms.sig, so reformatting those files would invalidate the
signature.
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Jun 2, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant