File size: 1,344 Bytes
3af8cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Pre-commit hooks configuration
# Install: pip install pre-commit && pre-commit install
# Run manually: pre-commit run --all-files

repos:
  # Python syntax checking
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
      - id: check-ast
        name: Check Python AST
        description: Validates Python syntax before commit
      - id: check-yaml
        name: Check YAML syntax
      - id: check-json
        name: Check JSON syntax
      - id: end-of-file-fixer
        name: Fix end of files
      - id: trailing-whitespace
        name: Trim trailing whitespace
      - id: check-added-large-files
        name: Check for large files
        args: ['--maxkb=500']
      - id: check-merge-conflict
        name: Check for merge conflicts
      - id: debug-statements
        name: Check for debug statements
  
  # Python code formatting
  - repo: https://github.com/psf/black
    rev: 23.12.1
    hooks:
      - id: black
        name: Format with Black
        language_version: python3
        args: ['--line-length=100']
  
  # Python linting with Ruff (ultra-fast)
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.1.9
    hooks:
      - id: ruff
        name: Lint with Ruff
        args: ['--fix', '--exit-non-zero-on-fix']
      - id: ruff-format
        name: Format with Ruff