Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(lint): adding pre-commit hook for checking chalk version across files #41

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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