| 1 | name: Checks |
| 2 | on: |
| 3 | pull_request: |
| 4 | merge_group: |
| 5 | push: |
| 6 | branches: [main] |
| 7 | jobs: |
| 8 | test: |
| 9 | runs-on: ubuntu-latest |
| 10 | steps: |
| 11 | - uses: actions/checkout@v7 |
| 12 | - name: Unit tests |
| 13 | run: node test.js |
| 14 | - name: House style |
| 15 | run: | |
| 16 | # Every exported function is documented with a JSDoc block. |
| 17 | for fn in $(grep -oE '^function [a-zA-Z]+' math.js | cut -d' ' -f2); do |
| 18 | if ! grep -B1 "^function $fn" math.js | grep -q '^ \*/\|^\*/\|\*/$'; then |
| 19 | echo "::error file=math.js,title=House style::$fn needs a /** JSDoc */ comment right above it" |
| 20 | exit 1 |
| 21 | fi |
| 22 | done |
| 23 | echo "house style ok" |