|
| 1 | +colors: true |
| 2 | +skip_output: |
| 3 | + - summary |
| 4 | + |
| 5 | +pre-commit: |
| 6 | + parallel: true |
| 7 | + |
| 8 | + jobs: |
| 9 | + # Checks group - runs in parallel |
| 10 | + - group: |
| 11 | + parallel: true |
| 12 | + jobs: |
| 13 | + - name: sorbet |
| 14 | + glob: '*.{rb,rbi}' |
| 15 | + run: scripts/typecheck.sh |
| 16 | + |
| 17 | + - name: typescript |
| 18 | + glob: 'site/**/*.{ts,tsx,js,jsx}' |
| 19 | + run: cd site && pnpm exec tsc --noEmit |
| 20 | + |
| 21 | + - name: typescript-export |
| 22 | + glob: 'lib/**/*.rb' |
| 23 | + run: scripts/export_typescript_types.rb |
| 24 | + |
| 25 | + - name: cspell |
| 26 | + glob: '*.{rb,md,yml,yaml,txt,ts,tsx,js,jsx}' |
| 27 | + run: scripts/spellcheck.sh |
| 28 | + |
| 29 | + - name: eslint |
| 30 | + glob: 'site/**/*.{ts,tsx,js,jsx}' |
| 31 | + run: cd site && pnpm run lint |
| 32 | + |
| 33 | + - name: typescript-tests |
| 34 | + glob: 'site/**/*.{ts,tsx}' |
| 35 | + run: cd site && pnpm test |
| 36 | + |
| 37 | + - name: ruby-tests |
| 38 | + glob: '{lib,test}/**/*.rb' |
| 39 | + run: scripts/test.rb |
| 40 | + |
| 41 | + # Fixes group - runs sequentially to avoid git conflicts |
| 42 | + - group: |
| 43 | + parallel: false |
| 44 | + jobs: |
| 45 | + - name: fix-whitespace |
| 46 | + run: | |
| 47 | + for file in {staged_files}; do |
| 48 | + if [[ -f "$file" ]]; then |
| 49 | + # Remove trailing whitespace (portable sed usage) |
| 50 | + if [[ "$OSTYPE" == "darwin"* ]]; then |
| 51 | + sed -i '' 's/[[:space:]]*$//' "$file" |
| 52 | + else |
| 53 | + sed -i 's/[[:space:]]*$//' "$file" |
| 54 | + fi |
| 55 | + # Ensure file ends with newline |
| 56 | + if [[ -s "$file" ]] && [[ $(tail -c1 "$file" | wc -l) -eq 0 ]]; then |
| 57 | + echo >> "$file" |
| 58 | + fi |
| 59 | + fi |
| 60 | + done |
| 61 | + file_types: |
| 62 | + - text |
| 63 | + exclude: '**/.*' |
| 64 | + stage_fixed: true |
| 65 | + |
| 66 | + - name: prettier |
| 67 | + glob: '*.{js,jsx,ts,tsx,json,yml,yaml,md}' |
| 68 | + run: scripts/prettier.sh --write {staged_files} |
| 69 | + stage_fixed: true |
| 70 | + |
| 71 | + - name: rubocop |
| 72 | + glob: '*.rb' |
| 73 | + run: scripts/rubocop.rb -A {staged_files} |
| 74 | + stage_fixed: true |
| 75 | + |
| 76 | +# Optional: Run full test suite manually with lefthook run full-tests |
| 77 | +full-tests: |
| 78 | + parallel: false |
| 79 | + |
| 80 | + # Run complete test suite including Rails integration tests |
| 81 | + all-tests: |
| 82 | + run: scripts/all_tests.sh |
| 83 | + fail_text: 'Full test suite failed' |
0 commit comments