mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-03-09 07:15:51 -05:00
Add collapse_blank_lines.py script and pre-commit hook that automatically collapses 2+ consecutive blank lines into a single blank line. Preserves blank lines inside code blocks. Applies to .md and .py files in the TinyTorch repository.
56 lines
2.0 KiB
YAML
56 lines
2.0 KiB
YAML
# TinyTorch Pre-commit Configuration
|
|
# =============================================================================
|
|
# CLI and module validation hooks for TinyTorch
|
|
#
|
|
# This config is called by the root .pre-commit-config.yaml router
|
|
# Run manually: cd tinytorch && pre-commit run --config .pre-commit-config.yaml --all-files
|
|
# =============================================================================
|
|
|
|
repos:
|
|
# ===========================================================================
|
|
# MARKDOWN FORMATTING
|
|
# ===========================================================================
|
|
|
|
- repo: local
|
|
hooks:
|
|
- id: collapse-blank-lines
|
|
name: "TinyTorch: Collapse extra blank lines"
|
|
description: "Replace 2+ consecutive blank lines with single blank line"
|
|
entry: python3 tools/dev/collapse_blank_lines.py
|
|
language: python
|
|
files: \.(md|py)$
|
|
pass_filenames: true
|
|
|
|
# ===========================================================================
|
|
# CLI DOCUMENTATION VALIDATORS
|
|
# ===========================================================================
|
|
|
|
- repo: local
|
|
hooks:
|
|
- id: validate-cli-docs
|
|
name: "TinyTorch: Validate CLI documentation"
|
|
description: "Ensure tito commands in docs match actual CLI"
|
|
entry: python3 tools/dev/validate_cli_docs.py
|
|
language: python
|
|
files: \.md$
|
|
pass_filenames: false
|
|
|
|
# ===========================================================================
|
|
# PYTHON CODE QUALITY
|
|
# ===========================================================================
|
|
|
|
# Uncomment to enable Python linting/formatting
|
|
# - repo: https://github.com/psf/black
|
|
# rev: 24.4.2
|
|
# hooks:
|
|
# - id: black
|
|
# name: "Format Python code"
|
|
# files: ^(src/|tinytorch/|tools/).*\.py$
|
|
|
|
# - repo: https://github.com/pycqa/isort
|
|
# rev: 5.13.2
|
|
# hooks:
|
|
# - id: isort
|
|
# name: "Sort imports"
|
|
# files: ^(src/|tinytorch/|tools/).*\.py$
|