From 9cbb2479dd1538e91404ca1d0b7fa427ab527992 Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Mon, 4 Nov 2024 19:38:30 +0800 Subject: [PATCH] chore: Add cspell check hook for lefthook (#103) --- cspell.yml | 18 ++++++++++++++++++ lefthook.yml | 33 +++++++++++++++++++++++++++++++++ nu/milestone.nu | 2 +- nu/release.nu | 4 ++-- 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 cspell.yml create mode 100644 lefthook.yml diff --git a/cspell.yml b/cspell.yml new file mode 100644 index 00000000..94347b2 --- /dev/null +++ b/cspell.yml @@ -0,0 +1,18 @@ +# REF: +# https://cspell.org/configuration/ +# Usage: +# npx cspell --no-progress . + +words: +- ECODE +- endfor +- dotenv +- nushell +- hustcer +- rsbuild +- justfile +- lefthook +- linewise +- hovercards +ignorePaths: + diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 00000000..525ca9d --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,33 @@ +# EXAMPLE USAGE +# Refer for explanation to following link: +# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md +# +# pre-push: +# commands: +# packages-audit: +# tags: frontend security +# run: yarn audit +# gems-audit: +# tags: backend security +# run: bundle audit +# +min_version: 1.7.12 +no_tty: false +skip_output: + - meta # Skips lefthook version printing + - skips # Skips "skip" printing (i.e. no files matched) + - summary # Skips summary block (successful and failed steps) printing + - success # Skips successful steps printing + - failure # Skips failed steps printing + - execution_info # Skips printing `EXECUTE > ...` logging + +pre-commit: + parallel: true + commands: + spell-check: + skip: + - merge + - rebase + stage_fixed: true + glob: "*.*" + run: cspell --no-progress {staged_files} diff --git a/nu/milestone.nu b/nu/milestone.nu index c90c227..dd251ce 100644 --- a/nu/milestone.nu +++ b/nu/milestone.nu @@ -110,7 +110,7 @@ export def 'milestone-bind-for-issue' [ } } -# Guess milestone by the merged date of the PR and the infomation of open milestones. +# Guess milestone by the merged date of the PR and the information of open milestones. def guess-milestone-for-pr [repo: string, pr: string] { # Query github open milestone list by gh let milestones = gh api -X GET $'/repos/($repo)/milestones' --paginate | from json diff --git a/nu/release.nu b/nu/release.nu index 7c236d8..302217b 100644 --- a/nu/release.nu +++ b/nu/release.nu @@ -5,7 +5,7 @@ # # TODO: # [√] Make sure the release tag does not exist; -# [√] Make sure there are no uncommit changes; +# [√] Make sure there are no uncommitted changes; # [√] Update change log if required; # [√] Create a release tag and push it to the remote repo; # Usage: @@ -25,7 +25,7 @@ export def 'make-release' [ let majorTag = $releaseVer | split row '.' | first let statusCheck = (git status --porcelain) if not ($statusCheck | is-empty) { - echo $'You have uncommit changes, please commit them and try `release` again!(char nl)' + echo $'You have uncommitted changes, please commit them and try `release` again!(char nl)' exit 5 } if ($update_log) {