-
Notifications
You must be signed in to change notification settings - Fork 353
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
88 lines (78 loc) · 3.56 KB
/
.pre-commit-config.yaml
File metadata and controls
88 lines (78 loc) · 3.56 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
# Pre-commit hooks configuration
# See https://pre-commit.com for more information
repos:
# Secret scanning (blocks commits containing API keys, tokens, URLs)
- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.0
hooks:
- id: gitleaks
# General hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-merge-conflict
# Android Lint temporarily disabled due to compilation issues
# - repo: local
# hooks:
# - id: android-sdk-lint
# name: Android SDK Lint
# entry: bash -c 'cd sdk/runanywhere-android && if [ -f "./gradlew" ] && [ -n "$ANDROID_HOME" -o -f "../../../local.properties" ]; then ./gradlew lint; else echo "Skipping Android lint (no gradle or SDK)"; exit 0; fi'
# language: system
# files: ^sdk/runanywhere-android/.*\.(kt|kts|java|xml)$
# pass_filenames: false
# - repo: local
# hooks:
# - id: android-app-lint
# name: Android App Lint
# entry: bash -c 'cd examples/android/RunAnywhereAI && if [ -f "./gradlew" ] && [ -n "$ANDROID_HOME" -o -f "local.properties" ]; then ./gradlew :app:lint; else echo "Skipping Android lint (no gradle or SDK)"; exit 0; fi'
# language: system
# files: ^examples/android/RunAnywhereAI/.*\.(kt|kts|java|xml)$
# pass_filenames: false
# SwiftLint for iOS SDK (with autofix)
- repo: local
hooks:
- id: ios-sdk-swiftlint-fix
name: iOS SDK SwiftLint AutoFix
entry: bash -c 'cd sdk/runanywhere-swift && if which swiftlint >/dev/null; then swiftlint --fix --quiet 2>/dev/null || true; else echo "SwiftLint not installed"; fi'
language: system
files: ^sdk/runanywhere-swift/.*\.swift$
pass_filenames: false
- id: ios-sdk-swiftlint
name: iOS SDK SwiftLint
entry: bash -c 'cd sdk/runanywhere-swift && if which swiftlint >/dev/null; then swiftlint --strict; else echo "SwiftLint not installed"; exit 0; fi'
language: system
files: ^sdk/runanywhere-swift/.*\.swift$
pass_filenames: false
- id: ios-sdk-periphery
name: iOS SDK Periphery (Unused Code)
entry: bash -c 'cd sdk/runanywhere-swift && if which periphery >/dev/null; then OUTPUT=$(periphery scan --targets RunAnywhere --targets ONNXRuntime --targets LlamaCPPRuntime --targets FoundationModelsAdapter --targets FluidAudioDiarization 2>&1); WARNINGS=$(echo "$OUTPUT" | grep "warning:" | grep -v "Associatedtype .* is unused"); if [ -n "$WARNINGS" ]; then echo "$WARNINGS"; echo "Periphery found unused code"; exit 1; fi; exit 0; else echo "Periphery not installed"; exit 0; fi'
language: system
files: ^sdk/runanywhere-swift/.*\.swift$
pass_filenames: false
# SwiftLint for iOS App
- repo: local
hooks:
- id: ios-app-swiftlint
name: iOS App SwiftLint
entry: bash -c 'cd examples/ios/RunAnywhereAI && if which swiftlint >/dev/null; then swiftlint --quiet --reporter csv 2>/dev/null || true; else echo "SwiftLint not installed"; exit 0; fi'
language: system
files: ^examples/ios/RunAnywhereAI/.*\.swift$
pass_filenames: false
# Configuration
default_language_version:
python: python3
# Skip these hooks during CI (they run in dedicated CI jobs)
ci:
skip:
- gitleaks
- android-sdk-lint
- android-app-lint
- ios-sdk-swiftlint-fix
- ios-sdk-swiftlint
- ios-sdk-periphery
- ios-app-swiftlint