Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.52 KB

File metadata and controls

57 lines (42 loc) · 1.52 KB

Pre-commit Hooks for Avlos

This project uses pre-commit to automatically format and lint code before commits.

Setup

  1. Install pre-commit (if not already installed):

    pip install pre-commit
  2. Install the git hooks:

    pre-commit install

What Gets Checked

The pre-commit hooks run the following checks:

  • black: Python code formatting (line length: 127)
  • isort: Import statement sorting
  • flake8: Python linting (configured in setup.cfg)
  • trailing-whitespace: Removes trailing whitespace
  • end-of-file-fixer: Ensures files end with a newline
  • check-yaml: Validates YAML syntax
  • check-added-large-files: Prevents large files from being committed
  • check-merge-conflict: Detects merge conflict markers
  • mixed-line-ending: Ensures consistent line endings
  • rstcheck: Validates RST documentation files

Manual Execution

To run all hooks on all files (useful after initial setup or major changes):

pre-commit run --all-files

To run hooks on specific files:

pre-commit run --files path/to/file1.py path/to/file2.py

To skip hooks for a single commit (not recommended):

git commit --no-verify

Configuration

  • Pre-commit hooks are configured in .pre-commit-config.yaml
  • Flake8 and isort settings are in setup.cfg
  • clang-format style is configured in .clang-format

CI Integration

The same linting checks run in GitHub Actions CI, so passing pre-commit locally ensures CI will pass.