Skip to content

Add pre-commit hooks for code quality and security #51

@saquibsaifee

Description

@saquibsaifee

Proposal

Add pre-commit hooks to automate code quality and security checks before commits.

Current State

  • No automated code quality checks
  • Style and security issues caught only during PR reviews
  • No standardized contribution workflow

Proposed Pre-commit Hooks

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    hooks:
      - id: ruff          # Linting
      - id: ruff-format   # Code formatting

  - repo: https://github.com/pre-commit/mirrors-mypy
    hooks:
      - id: mypy          # Type checking

  - repo: https://github.com/PyCQA/bandit
    hooks:
      - id: bandit        # Security scanning

  - repo: https://github.com/pre-commit/pre-commit-hooks
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files

Benefits

  1. ✅ Catches issues before commit (faster feedback)
  2. ✅ Consistent code style across contributors
  3. ✅ Automated security scanning
  4. ✅ Reduces PR review time
  5. ✅ Enforces best practices automatically

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions