The pre_commit.py module#

Summary#

PreCommit

Pre-commit rule family.

PC001

The .pre-commit-config.yaml file exists.

PC002

Ruff-pre-commit is configured.

PC003

Zizmor is configured with –pedantic or –persona=pedantic.

PC004

Codespell is configured.

PC005

Ansys/pre-commit-hooks is configured.

PC006

A pyright, mypy, or ty type-checking hook is configured.

PC007

Check-merge-conflict is configured.

PC008

Debug-statements is configured.

PC009

Check-yaml is configured.

PC010

Trailing-whitespace is configured.

Description#

Pre-commit configuration checks.

This rule set validates the repository pre-commit configuration.

The checks cover:

  • The .pre-commit-config.yaml file exists

  • The ruff-pre-commit and ansys/pre-commit-hooks repositories are configured

  • Optional hooks are configured: zizmor (with pedantic mode), codespell, a type checker (pyright, mypy or ty), and the check-merge-conflict, debug-statements, check-yaml and trailing-whitespace hooks

A missing required item is reported as an ERROR. A missing optional hook is reported as a RECOMMENDATION that explains the benefit of adding it. A recommendation never fails the report.