-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
135 lines (120 loc) · 4 KB
/
.pre-commit-config.yaml
File metadata and controls
135 lines (120 loc) · 4 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
repos:
# Python formatting and linting
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
args: ["--profile", "black"]
# Rust formatting via local toolchain
- repo: local
hooks:
- id: rustfmt
name: Rust Format
description: Format Rust files with cargo fmt (same as CI)
entry: cargo fmt --all
language: system
files: '\.rs$'
pass_filenames: false
# Go formatting
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
# JavaScript/TypeScript formatting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
files: '\.(js|ts|json|yaml|yml|md)$'
exclude: '(package-lock\.json|\.lock)$'
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: '\.patch$'
- id: end-of-file-fixer
exclude: '\.patch$'
- id: check-yaml
exclude: '\.md$'
# - id: check-toml
- id: check-json
- id: check-merge-conflict
- id: check-case-conflict
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: detect-private-key
# Conventional commits validation
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [feat, fix, docs, style, refactor, perf, test, build, ci, chore]
# Security checks
# Temporarily disabled - flagging legitimate SHA256 hashes and git commits
# - repo: https://github.com/Yelp/detect-secrets
# rev: v1.5.0
# hooks:
# - id: detect-secrets
# args: ['--baseline', '.secrets.baseline']
# Custom local hooks
- repo: local
hooks:
# Rust clippy linting via Bazel (disabled - using cargo-clippy-check instead)
# - id: rust-clippy
# name: Rust Clippy
# description: Run clippy on all Rust code via Bazel
# entry: bazel build //:clippy
# language: system
# files: '\.rs$'
# pass_filenames: false
# Rust formatting check (same as CI)
- id: rust-format-check
name: Rust Format Check
description: Check Rust formatting (same as CI validation)
entry: cargo fmt --all -- --check
language: system
files: '\.rs$'
pass_filenames: false
# Cargo clippy check (same as CI)
- id: cargo-clippy-check
name: Cargo Clippy Check
description: Run clippy with warnings as errors (same as CI)
entry: cargo clippy --all-features --all-targets --release -- -D warnings
language: system
files: '\.rs$'
pass_filenames: false
# Cargo test check (quick subset of CI tests)
- id: cargo-test-check
name: Cargo Test Check
description: Run quick tests to catch major issues before CI
entry: cargo test --workspace --lib --all-features
language: system
files: '\.rs$'
pass_filenames: false
# WIT file validation
- id: wit-validation
name: WIT File Validation
description: Validate WIT files are syntactically correct
entry: bash -c 'for file in "$@"; do echo "Validating $file"; done'
language: system
files: '\.wit$'
# Bazel build test for changed files (disabled - no Bazel workspace)
# - id: bazel-test-changed
# name: Bazel Test Changed
# description: Run tests for changed Bazel targets
# entry: bash -c 'echo "Running tests for changed files..." && bazel test //test/unit:unit_tests'
# language: system
# files: '\.bzl$|\.bazel$|BUILD$'
# pass_filenames: false
ci:
autofix_commit_msg: |
style: auto fixes from pre-commit hooks
autoupdate_commit_msg: |
chore: update pre-commit hooks