Skip to content

Commit

Permalink
test(lint): adding pre-commit hook for checking chalk version across …
Browse files Browse the repository at this point in the history
…files (#41)

this will check chalk version matches across various files. currently
we only check:

* nimble file
* base_keyspecs.c4m

If the chalk version is updated in nimble file, all other files
need to match it.
  • Loading branch information
miki725 authored Oct 6, 2023
1 parent 0a573fb commit 2f1b55c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/check_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -eEu
set -o pipefail

FILEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$FILEDIR" 1> /dev/null 2>&1

# cd to root of the repo
cd ..

KEYSPEC=src/configs/base_keyspecs.c4m
current_version=$(make version)
keyspec_version=$(
grep -E "chalk_version\s:=" $KEYSPEC \
| cut -d'"' -f2
)

if [ "$current_version" != "$keyspec_version" ]; then
echo $KEYSPEC chalk_version does not match nimble chalk version
echo "$keyspec_version != $current_version"
exit 1
fi
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ repos:
data/.*
)$
- repo: local
hooks:
- id: chalkversion
name: chalkversion
description: verify chalk version matches across all chalk files
entry: ./.github/check_version.sh
language: system
always_run: true
pass_filenames: false

- repo: https://github.com/tcort/markdown-link-check
rev: v3.11.2
hooks:
Expand Down

0 comments on commit 2f1b55c

Please sign in to comment.