Files
python-sdk/.pre-commit-config.yaml
zeekay bff668fbf6 feat: Add STRICT CI/CD quality gates - NO MORE TODO/STUB BULLSHIT
- Added comprehensive anti-stub test suite that detects:
  - TODO/FIXME/STUB/FAKE/UNFINISHED patterns
  - Empty functions with only pass/ellipsis
  - NotImplementedError raises
  - Mock implementations in production
  - Debug prints in production
  - Skipped tests

- Created strict GitHub Actions workflow that:
  - BLOCKS deployment if ANY forbidden patterns found
  - Requires ALL tests to pass (no skips allowed)
  - Runs security scans
  - Verifies all functions are implemented
  - Only allows PyPI publish after ALL checks pass

- Added pre-commit hooks to catch issues locally before push
- Updated Makefile with 'make check' that runs all quality gates
- Fixed stub function issue in tools/__init__.py

This ensures we NEVER deploy incomplete or stub code to production again!
2025-09-17 02:55:28 +00:00

78 lines
2.2 KiB
YAML

repos:
# Block TODO/STUB/FAKE patterns
- repo: local
hooks:
- id: block-todos
name: Block TODO/STUB/FAKE code
entry: bash -c 'grep -r "TODO\|STUB\|FAKE\|UNFINISHED\|NotImplementedError" --include="*.py" --exclude-dir=test . && exit 1 || exit 0'
language: system
pass_filenames: false
always_run: true
fail_fast: true
- id: no-debug-prints
name: Block debug prints
entry: bash -c 'grep -r "print(.*#.*DEBUG\|console\.log\|debugger" --include="*.py" . && exit 1 || exit 0'
language: system
pass_filenames: false
- id: no-empty-functions
name: Block empty functions
entry: python scripts/check_empty_functions.py
language: python
pass_filenames: false
additional_dependencies: [ast]
# Python code quality
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
# Type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
args: [--ignore-missing-imports, --strict]
additional_dependencies: [types-all]
# Security scanning
- repo: https://github.com/PyCQA/bandit
rev: '1.8.0'
hooks:
- id: bandit
args: [-r, --skip, B101]
# Standard pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=500']
- id: check-merge-conflict
- id: check-ast
- id: debug-statements
- id: detect-private-key
# Prevent direct commits to main
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: no-commit-to-branch
args: [--branch, main, --branch, master]
# Run tests before commit
- repo: local
hooks:
- id: pytest-check
name: Run pytest
entry: bash -c 'cd pkg/hanzo-mcp && python -m pytest tests/test_no_stubs.py -x'
language: system
pass_filenames: false
stages: [commit]