- Add pre-commit hooks: Ruff lint/format, Bandit security scan, YAML/TOML validation - Add GitHub Actions CI workflow: lint, security, test, and build jobs - Configure Ruff and Bandit in pyproject.toml - Add pytest test suite for build_epub.py (25 tests) - Fix code issues: exception chaining, httpx timeout, formatting - Add requirements.txt and requirements-dev.txt
55 lines
1.5 KiB
YAML
55 lines
1.5 KiB
YAML
# Pre-commit hooks for claude-howto project
|
|
# Run `pre-commit install` to set up hooks
|
|
# Run `pre-commit run --all-files` to check all files
|
|
|
|
default_language_version:
|
|
python: python3.11
|
|
|
|
repos:
|
|
# Ruff - Fast Python linter and formatter
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: v0.8.2
|
|
hooks:
|
|
# Ruff linter
|
|
- id: ruff
|
|
name: ruff-lint
|
|
args: [--fix, --exit-non-zero-on-fix]
|
|
types_or: [python, pyi]
|
|
files: ^scripts/
|
|
# Ruff formatter (replaces black)
|
|
- id: ruff-format
|
|
name: ruff-format
|
|
types_or: [python, pyi]
|
|
files: ^scripts/
|
|
|
|
# Bandit - Security linter
|
|
- repo: https://github.com/PyCQA/bandit
|
|
rev: 1.7.10
|
|
hooks:
|
|
- id: bandit
|
|
name: bandit-security
|
|
args: [-c, pyproject.toml]
|
|
additional_dependencies: ["bandit[toml]"]
|
|
types: [python]
|
|
files: ^scripts/
|
|
exclude: ^scripts/tests/
|
|
|
|
# Standard pre-commit hooks
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v5.0.0
|
|
hooks:
|
|
- id: check-yaml
|
|
name: check-yaml
|
|
args: [--allow-multiple-documents]
|
|
- id: check-toml
|
|
name: check-toml
|
|
- id: end-of-file-fixer
|
|
name: fix-end-of-file
|
|
- id: trailing-whitespace
|
|
name: fix-trailing-whitespace
|
|
- id: check-added-large-files
|
|
name: check-large-files
|
|
args: [--maxkb=1000]
|
|
- id: check-merge-conflict
|
|
name: check-merge-conflict
|