Files
MsgCenterPy/.pre-commit-config.yaml
Xuwznln 37010bdeb1 refactor: migrate from bump2version to bump-my-version for version management
- Removed .bumpversion.cfg and integrated version management into pyproject.toml.
- Updated pre-commit hooks and dependencies for code formatting, linting, and type checking.
- Added new functionality to JSONSchemaMessageInstance for generating default values from JSON schema.
- Enhanced test coverage for the new default value generation feature.
2026-02-28 20:49:02 +08:00

78 lines
2.9 KiB
YAML

# MsgCenterPy pre-commit hooks
# All tool configs are centralised in pyproject.toml
repos:
# ── Code formatting ───────────────────────────────────────────
- repo: https://github.com/psf/black
rev: 26.1.0
hooks:
- id: black
language_version: python3
# Reads [tool.black] from pyproject.toml
# ── Import sorting ────────────────────────────────────────────
- repo: https://github.com/pycqa/isort
rev: 6.1.0
hooks:
- id: isort
# Reads [tool.isort] from pyproject.toml
# ── Linting ───────────────────────────────────────────────────
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
additional_dependencies: ["Flake8-pyproject"]
# Reads [tool.flake8] from pyproject.toml via Flake8-pyproject
# ── Type checking ─────────────────────────────────────────────
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
args: ["--config-file=pyproject.toml"]
files: "^(msgcenterpy/)"
additional_dependencies:
- "pydantic>=2.0"
- "types-PyYAML"
- "types-jsonschema"
# ── Basic file checks ────────────────────────────────────────
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: check-case-conflict
- id: check-symlinks
- id: check-added-large-files
- id: check-ast
- id: debug-statements
- id: name-tests-test
args: ["--pytest-test-first"]
# ── Security scanning ────────────────────────────────────────
- repo: https://github.com/PyCQA/bandit
rev: 1.9.3
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]", "pbr"]
exclude: "^(tests/)"
# ── YAML/JSON/Markdown formatting ────────────────────────────
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [yaml, json, markdown]
exclude: "^(build/|dist/|__pycache__/|\\.mypy_cache/|\\.pytest_cache/|htmlcov/|\\.vscode/|docs/_build/|msgcenterpy\\.egg-info/)"
# Global settings
default_stages: [pre-commit]
fail_fast: false