# Pre-commit hooks configuration # See https://pre-commit.com for more information repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-toml - id: check-added-large-files args: ['--maxkb=1024'] # docs/assets/architecture.drawio.png 约 512KB - id: check-merge-conflict - id: no-commit-to-branch args: ['--branch', 'main'] - repo: https://github.com/psf/black rev: 24.8.0 hooks: - id: black language_version: python3 - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: - id: isort args: ['--profile', 'black'] # 本仓托管在 Gitee,.github/workflows 不会执行——测试门禁落在本地 pre-commit。 # 安装:pip install pre-commit && pre-commit install - repo: local hooks: - id: sapcli-unit-tests name: sap-cli 全量测试(698 例) entry: python -m unittest discover -s tests -p "test_*.py" language: system pass_filenames: false files: '\.py$' - repo: https://github.com/pycqa/flake8 rev: 7.1.1 hooks: - id: flake8 args: ['--max-line-length=120', '--extend-ignore=E501,W503'] additional_dependencies: [flake8-bugbear]