04d18ee1f7
- Create pyproject.toml with python-semantic-release configuration - Add release.yml workflow for automated releases - Add commitlint pre-commit hook for conventional commits validation - Add python-semantic-release to dev dependencies Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
80 lines
1.9 KiB
YAML
80 lines
1.9 KiB
YAML
# Pre-commit hooks for code quality and security
|
|
# Install: pip install pre-commit
|
|
# Setup: pre-commit install
|
|
# Run manually: pre-commit run --all-files
|
|
|
|
repos:
|
|
# General file checks
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.5.0
|
|
hooks:
|
|
- id: trailing-whitespace
|
|
- id: end-of-file-fixer
|
|
- id: check-yaml
|
|
- id: check-json
|
|
- id: check-added-large-files
|
|
args: ['--maxkb=1000']
|
|
- id: check-merge-conflict
|
|
- id: detect-private-key
|
|
- id: detect-aws-credentials
|
|
args: ['--allow-missing-credentials']
|
|
|
|
# Python code formatting
|
|
- repo: https://github.com/psf/black
|
|
rev: 24.1.1
|
|
hooks:
|
|
- id: black
|
|
args: ['--line-length=120']
|
|
language_version: python3.11
|
|
|
|
# Import sorting
|
|
- repo: https://github.com/PyCQA/isort
|
|
rev: 5.13.2
|
|
hooks:
|
|
- id: isort
|
|
args: ['--profile=black', '--line-length=120']
|
|
|
|
# Linting
|
|
- repo: https://github.com/PyCQA/flake8
|
|
rev: 7.0.0
|
|
hooks:
|
|
- id: flake8
|
|
args: ['--max-line-length=120', '--extend-ignore=E203,W503']
|
|
|
|
# Security linting
|
|
- repo: https://github.com/PyCQA/bandit
|
|
rev: 1.7.6
|
|
hooks:
|
|
- id: bandit
|
|
args: ['-ll', '-r', 'app/']
|
|
exclude: 'tests/'
|
|
|
|
# Type checking
|
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
rev: v1.8.0
|
|
hooks:
|
|
- id: mypy
|
|
args: ['--ignore-missing-imports']
|
|
additional_dependencies: ['types-requests']
|
|
|
|
# Secret detection
|
|
- repo: https://github.com/Yelp/detect-secrets
|
|
rev: v1.4.0
|
|
hooks:
|
|
- id: detect-secrets
|
|
args: ['--baseline', '.secrets.baseline']
|
|
exclude: |
|
|
(?x)^(
|
|
.+\.lock|
|
|
.+\.json|
|
|
.env.demo
|
|
)$
|
|
|
|
# Conventional commits validation
|
|
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
rev: v3.0.0
|
|
hooks:
|
|
- id: conventional-pre-commit
|
|
stages: [commit-msg]
|
|
args: []
|