# Pre-commit hooks for Cidadão.AI Backend # Install with: pre-commit install repos: # Code formatting - repo: https://github.com/psf/black rev: 24.1.1 hooks: - id: black language_version: python3.11 args: [--line-length=88] # Import sorting - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: - id: isort args: [--profile=black] # Linting - repo: https://github.com/charliermarsh/ruff-pre-commit rev: v0.1.15 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] # Security checks - repo: https://github.com/PyCQA/bandit rev: 1.7.5 hooks: - id: bandit args: [-r, src/, -f, json, -o, bandit-report.json] pass_filenames: false # 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-toml - id: check-json - id: check-merge-conflict - id: check-added-large-files args: [--maxkb=1000] - id: detect-private-key # Python-specific checks - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-ast - id: check-docstring-first - id: debug-statements # Secrets detection - repo: https://github.com/Yelp/detect-secrets rev: v1.4.0 hooks: - id: detect-secrets args: [--baseline, .secrets.baseline] exclude: | (?x)^( \.env\.example| \.env\.production| tests/.*| docs/.* )$ # Configuration default_language_version: python: python3.11 ci: autofix_commit_msg: | [pre-commit.ci] auto fixes from pre-commit hooks for more information, see https://pre-commit.ci autofix_prs: true autoupdate_branch: '' autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' autoupdate_schedule: weekly skip: [] submodules: false