diff --git a/.circleci/linter_configs/.commitspell.yml b/.circleci/linter_configs/.commitspell.yml new file mode 100644 index 0000000..4109c18 --- /dev/null +++ b/.circleci/linter_configs/.commitspell.yml @@ -0,0 +1,27 @@ +--- + +enableGlobDot: true + +patterns: + - name: GithubUser + pattern: /\[@.+\]/gmx + +languageSettings: + - languageId: markdown + ignoreRegExpList: + - Email + - GithubUser + +words: + - autoreleasing + - gitter + - trotsenko + - vladislav + - bestwebua + - codebases + - dockerhub + - dockerized + - healthcheck + - truemail + - lefthook + - commitspell diff --git a/.circleci/linter_configs/.lefthook.yml b/.circleci/linter_configs/.lefthook.yml index e1759a4..aac2c84 100644 --- a/.circleci/linter_configs/.lefthook.yml +++ b/.circleci/linter_configs/.lefthook.yml @@ -6,6 +6,8 @@ skip_output: linters: commands: + commitspell: + run: .circleci/scripts/commitspell.sh -c '.circleci/linter_configs/.commitspell.yml' cspell: run: cspell-cli lint -c '.circleci/linter_configs/.cspell.yml' '**/*.{txt,md}' markdownlint: diff --git a/.circleci/scripts/commitspell.sh b/.circleci/scripts/commitspell.sh new file mode 100755 index 0000000..d284cd0 --- /dev/null +++ b/.circleci/scripts/commitspell.sh @@ -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