ST011: HasPreCommitConfig

Overview

Property Value
ID ST011
Name HasPreCommitConfig
Group structure
Severity NOTE

Description

Checks for the presence of a .pre-commit-config.yaml file in the package root directory.

Pre-commit hooks help enforce code quality standards before commits are made, catching issues early in the development process.

What it checks

The check looks for .pre-commit-config.yaml in the package root.

Why it matters

  • Code Quality - Pre-commit hooks catch issues before they’re committed
  • Consistency - Enforces formatting and linting standards across contributors
  • Automation - Reduces manual review burden
  • CI Efficiency - Prevents CI failures by catching issues locally

How to fix

Create a .pre-commit-config.yaml file in your repository root:

repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.1.0
    hooks:
      - id: ruff
        args: [--fix]
      - id: ruff-format

  - 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-added-large-files

Installation

Install pre-commit and set up the hooks:

pip install pre-commit
pre-commit install

Or with uv:

uv add --dev pre-commit
pre-commit install

Running manually

Run hooks on all files:

pre-commit run --all-files

Configuration

Skip this check

[tool.pycmdcheck]
skip = ["ST011"]

CLI

pycmdcheck --skip ST011