discord_bot/.pre-commit-config.yaml

70 lines
1.7 KiB
YAML

# Pre-commit hooks configuration for Fjerkroa Bot
repos:
# Built-in hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: debug-statements
- id: requirements-txt-fixer
# Black code formatter
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python3
args: [--line-length=140]
# isort import sorter
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile=black, --line-length=140]
# Flake8 linter
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--max-line-length=140]
# Bandit security scanner - disabled due to expected pickle/random usage
# - repo: https://github.com/pycqa/bandit
# rev: 1.7.5
# hooks:
# - id: bandit
# args: [-r, fjerkroa_bot]
# exclude: tests/
# MyPy type checker
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
hooks:
- id: mypy
additional_dependencies: [types-toml, types-requests, types-setuptools]
args: [--config-file=pyproject.toml, --ignore-missing-imports]
# Local hooks using Makefile
- repo: local
hooks:
- id: tests
name: Run tests
entry: make test-fast
language: system
pass_filenames: false
always_run: true
stages: [pre-commit]
# Configuration
default_stages: [pre-commit, pre-push]
fail_fast: false