Skip to content

Commit

Permalink
Technical/Add commit spellcheck linter
Browse files Browse the repository at this point in the history
* Added commit spellcheck linter, configuration
* Updated lefthook config
  • Loading branch information
bestwebua committed Feb 16, 2024
1 parent 8c911d6 commit 6e3104e
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .circleci/linter_configs/.commit_spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

enableGlobDot: true

patterns:
- name: GithubUser
pattern: /\[@.+\]/gmx

languageSettings:
- languageId: markdown
ignoreRegExpList:
- Email
- GithubUser

words:
- bestwebua
- codecov
- consts
- crtypto
- funcs
- golangci
- gomod
- gotestsum
- lefthook
- markdownlint
- multihomed
- punycode
- rubocop
- shellcheck
- shortcuting
- struct
- structs
- truemail
- yamlint
2 changes: 2 additions & 0 deletions .circleci/linter_configs/.lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ skip_output:

linters:
commands:
commit_spellcheck:
run: .circleci/scripts/commit_spellcheck.sh -c '.circleci/linter_configs/.commit_spellcheck.yml'
cspell:
run: cspell-cli lint -c '.circleci/linter_configs/.cspell.yml' '**/*.{txt,md}'
golangci:
Expand Down
22 changes: 22 additions & 0 deletions .circleci/scripts/commit_spellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
set -e

configuration=$(if [ "$2" = "" ]; then echo "$2"; else echo " $1 $2"; fi)
latest_commit=$(git rev-parse HEAD)

spellcheck_info() {
echo "Checking the spelling of the latest commit ($latest_commit) message..."
}

compose_cspell_command() {
echo "cspell-cli lint stdin$configuration"
}

cspell="$(compose_cspell_command)"

spellcheck_latest_commit() {
git log -1 --pretty=%B | $cspell
}

spellcheck_info
spellcheck_latest_commit

0 comments on commit 6e3104e

Please sign in to comment.