-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlefthook.yml
More file actions
93 lines (78 loc) · 2.48 KB
/
lefthook.yml
File metadata and controls
93 lines (78 loc) · 2.48 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
colors: true
pre-commit:
parallel: true
commands:
sorbet:
glob: '*.{rb,rbi}'
run: scripts/typecheck.sh
typescript:
glob: 'docs/**/*.{ts,tsx,js,jsx}'
run: cd docs && pnpm exec tsc --noEmit
typescript-export:
glob: '{schemas/log_sources/**/*,lib/log_struct/enums.rb,lib/log_struct/enums/*.rb,tools/codegen/**/*.rb,scripts/generate_structs.rb}'
run: scripts/generate_structs.rb
codegen-sync:
glob: '{schemas/log_sources/**/*,tools/codegen/templates/**/*,tools/codegen/**/*.rb,scripts/generate_structs.rb}'
run: scripts/check_generated.sh
cspell:
glob: '*.{rb,md,yml,yaml,txt,ts,tsx,js,jsx}'
run: scripts/spellcheck.sh
changelog:
glob: 'lib/log_struct/version.rb'
run: ruby scripts/check_changelog_version.rb
biome:
glob: '**/*.{ts,tsx,js,jsx,json}'
root: docs/
run: pnpm exec biome check --write {staged_files}
stage_fixed: true
typescript-tests:
glob: 'docs/**/*.{ts,tsx}'
run: cd docs && pnpm test
ruby-tests:
glob: '{lib,test}/**/*.rb'
run: scripts/test.rb
bundle-install:
glob: '{Gemfile,Gemfile.lock,lib/log_struct/version.rb}'
run: |
echo "Detected Gemfile/version change; running bundle install..."
bundle install
if [[ -f Gemfile.lock ]]; then
git add Gemfile.lock
fi
stage_fixed: true
fix-whitespace:
run: |
for file in {staged_files}; do
if [[ -f "$file" ]]; then
# Remove trailing whitespace (portable sed usage)
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/[[:space:]]*$//' "$file"
else
sed -i 's/[[:space:]]*$//' "$file"
fi
# Ensure file ends with newline
if [[ -s "$file" ]] && [[ $(tail -c1 "$file" | wc -l) -eq 0 ]]; then
echo >> "$file"
fi
fi
done
file_types:
- text
exclude: '**/.*'
stage_fixed: true
prettier:
glob: '*.{yml,yaml,md}'
run: scripts/prettier.sh --write {staged_files}
stage_fixed: true
rubocop:
glob: '*.rb'
run: bin/rubocop -A {staged_files}
stage_fixed: true
post-commit:
parallel: false
jobs:
- name: create-release-tag
run: |
if git show --pretty='' --name-only HEAD -- lib/log_struct/version.rb | grep -q 'lib/log_struct/version.rb'; then
./scripts/create_release_tag.sh
fi