-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
101 lines (90 loc) · 3.08 KB
/
.pre-commit-config.yaml
File metadata and controls
101 lines (90 loc) · 3.08 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
# Pre-commit configuration for Script Language
# See https://pre-commit.com for more information
# Install with: pip install pre-commit && pre-commit install
repos:
# Standard pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
- id: mixed-line-ending
args: ['--fix=lf']
# Rust-specific hooks
- repo: local
hooks:
# Cargo fmt (code formatting)
- id: cargo-fmt
name: Cargo Format
entry: cargo fmt
language: system
types: [rust]
pass_filenames: false
# Cargo clippy (linting)
- id: cargo-clippy
name: Cargo Clippy
entry: cargo clippy
language: system
args: ['--all-targets', '--all-features', '--', '-D', 'warnings']
types: [rust]
pass_filenames: false
# Cargo check (compilation check)
- id: cargo-check
name: Cargo Check
entry: cargo check
language: system
args: ['--all-targets', '--all-features']
types: [rust]
pass_filenames: false
# Cargo test (run tests)
- id: cargo-test
name: Cargo Test
entry: cargo test
language: system
args: ['--all-features']
types: [rust]
pass_filenames: false
# Benchmark compilation check
- id: cargo-bench-check
name: Cargo Bench Check
entry: cargo check
language: system
args: ['--benches']
types: [rust]
pass_filenames: false
# Documentation check
- id: cargo-doc
name: Cargo Doc Check
entry: cargo doc
language: system
args: ['--no-deps', '--all-features']
types: [rust]
pass_filenames: false
# File organization enforcement
- id: prevent-root-test-files
name: Prevent Root Test Files
entry: bash -c 'if ls test_*.script test_* debug_*.script temp_*.script 2>/dev/null | grep -v /; then echo "❌ Test files found in root directory. Move to tests/fixtures/ or examples/"; exit 1; else echo "✅ No root test files found"; fi'
language: system
pass_filenames: false
- id: check-script-file-location
name: Validate Script File Locations
entry: bash -c 'find . -name "*.script" -not -path "./examples/*" -not -path "./tests/*" -not -path "./benches/fixtures/*" | if grep -q .; then echo "❌ .script files found outside examples/ or tests/"; exit 1; else echo "✅ All .script files properly located"; fi'
language: system
pass_filenames: false
# Security audit (optional but recommended)
- repo: https://github.com/trailofbits/audit-action
rev: v1.3.0
hooks:
- id: cargo-audit
name: Cargo Audit
entry: cargo audit
language: system
pass_filenames: false
stages: [push] # Only run on push, not every commit
# Configuration
default_stages: [commit]
fail_fast: true