Skip to content

🔍 Investigate: Run pre-commit hooks inside Docker dev-container #116

@StephanMeijer

Description

@StephanMeijer

Context

From PR #113 discussion: #113 (comment)

The current pre-commit setup runs Python tools (ruff, pylint, etc.) in a local virtual environment. For developers using Docker dev-containers, this creates duplication: tools are installed both locally and in the container.

Problem Statement

  • Pre-commit hooks currently assume local Python/venv installation
  • Developers using dev-containers need tools installed twice (local + container)
  • Potential drift between local and container tool versions

Investigation Goals

  1. Feasibility: Can pre-commit hooks call tools via docker exec on an always-up container?
  2. Performance: Is the docker exec overhead acceptable for frequent commit operations?
  3. Configuration: How to conditionally switch between local and container execution?
  4. Cross-platform: Does this approach work well on Linux, macOS, and Windows (with Docker Desktop)?

Potential Solutions to Explore

  • Pre-commit wrapper script that detects container vs local environment
  • Custom pre-commit hooks that use docker exec
  • Make pre-commit entirely optional with CI/CD as the enforcing gate
  • Document the tradeoffs and let developers choose their workflow

Acceptance Criteria

  • Document findings with pros/cons of each approach
  • Recommend a path forward (implement, defer, or explicitly decide against)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions