Option C Tools
Loading...
Searching...
No Matches
oct.hooks.oct_hooks Namespace Reference

Functions

int install_hooks (Path root, bool force=False)

Variables

str _PRE_COMMIT_TEMPLATE

Detailed Description

Purpose
-------
Generate pre-commit hook configuration for Option C projects.

Responsibilities
----------------
- Generate a ``.pre-commit-config.yaml`` with ``oct lint --profile strict``
  as a pre-commit hook.
- Support ``--force`` to overwrite existing configuration.

Diagnostics
-----------
Domain: OCT-HOOKS
Levels:
    L2 — lifecycle
    L3 — semantic details
    L4 — deep tracing

Contracts
---------
- Must not overwrite existing ``.pre-commit-config.yaml`` without ``--force``.
- Generated configuration must be valid YAML.

Dependencies
------------

Function Documentation

◆ install_hooks()

int oct.hooks.oct_hooks.install_hooks ( Path root,
bool force = False )
Generate .pre-commit-config.yaml in the project root.

Returns exit code: 0 on success, 1 on failure.

Definition at line 59 of file oct_hooks.py.

Variable Documentation

◆ _PRE_COMMIT_TEMPLATE

str oct.hooks.oct_hooks._PRE_COMMIT_TEMPLATE
protected
Initial value:
1= """\
2# Option C pre-commit configuration
3# Generated by: oct install-hooks
4# See https://pre-commit.com for more information
5
6repos:
7 - repo: local
8 hooks:
9 - id: oct-lint
10 name: Option C Linter
11 entry: oct lint --profile strict
12 language: system
13 types: [python]
14 pass_filenames: false
15
16 - id: oct-format-check
17 name: Option C Format Check
18 entry: oct format --dry-run
19 language: system
20 types: [python]
21 pass_filenames: false
22"""

Definition at line 35 of file oct_hooks.py.