Skip to content

Proposal: Add pre-commit configuration for local linting and formatting #72

Description

@prateek-dagar

Proposing adding a .pre-commit-config.yaml to the root of the repository. This would allow developers to run formatters and linters automatically before committing their changes, catching issues locally and reducing CI noise.

Here is a sample configuration matching the project's current tooling:

  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.6.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-toml

  - repo: https://github.com/psf/black
    rev: 24.4.2
    hooks:
      - id: black
        # Matches black line-length = 100 configuration in pyproject.toml
        args: [--line-length=100]

  - repo: https://github.com/pypa/validate-pyproject
    rev: v0.18
    hooks:
      - id: validate-pyproject

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.10.0
    hooks:
      - id: mypy
        additional_dependencies: [types-freezegun]
        files: ^(src/|tests/)

  - repo: local
    hooks:
      - id: pylint
        name: pylint
        entry: pylint
        language: system
        types: [python]
        files: ^src/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions