-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
94 lines (81 loc) · 3.01 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
94 lines (81 loc) · 3.01 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Pre-commit hooks configuration for AI-Tutor project
# This configuration ensures code quality and consistency across the team
#
# Installation:
# pip install pre-commit
# pre-commit install
#
# Usage:
# pre-commit run --all-files # Run on all files
# git commit # Hooks run automatically on commit
repos:
# ============================================
# General file checks
# ============================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# Remove trailing whitespace
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: ^(assets/roster/.*\.svg|.*\.min\.(js|css)|.*\.lock|.*\.log|.*\.pdf|.*\.zip|.*\.tar\.gz)
# Ensure files end with a newline
- id: end-of-file-fixer
exclude: ^(assets/roster/.*\.svg|.*\.min\.(js|css)|.*\.lock|.*\.log|.*\.pdf|.*\.zip|.*\.tar\.gz)
# Check YAML files for syntax errors
- id: check-yaml
args: [--unsafe] # Allow custom tags in YAML
# Check JSON files for syntax errors
- id: check-json
exclude: ^(.*\.lock|.*\.log)
# Prevent committing large files
- id: check-added-large-files
args: [--maxkb=6144]
# Detect merge conflict markers
- id: check-merge-conflict
# Detect case conflicts in file names
- id: check-case-conflict
# Check for files that would conflict in case-insensitive filesystems
- id: check-toml
# ============================================
# Python code formatting and linting
# ============================================
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.7
hooks:
# Ruff linting - removing --exit-zero to ensure we catch issues before they land
- id: ruff
args: [--fix]
# Ruff import sorting
- id: ruff-format
# ============================================
# Frontend code formatting and linting
# ============================================
# Note: ESLint is disabled for now due to missing config file in /web
# - repo: https://github.com/pre-commit/mirrors-eslint
# rev: v9.17.0
# hooks:
# - id: eslint
# files: ^web/.*\.(js|jsx|ts|tsx)$
# exclude: ^web/(node_modules|\.next|out|dist|build)/
# additional_dependencies:
# - eslint@^9.0.0
# - eslint-config-next@^15.0.0
# - "@eslint/eslintrc"
# args: [--fix]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
files: ^web/.*\.(css|scss|json|jsonc|yaml|yml|md|graphql|html|ts|tsx|js|jsx)$
exclude: ^web/(node_modules|\.next|out|dist|build)/
# ============================================
# Security checks
# ============================================
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
exclude: package-lock.json
pass_filenames: false