Skip to content

Commit c765adb

Browse files
authored
Technical/Add commitspell linter (#86)
* Added commitspell linter, configuration * Updated lefthook config * Updated circleci config
1 parent d7cac48 commit c765adb

4 files changed

Lines changed: 70 additions & 0 deletions

File tree

.circleci/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ jobs:
7272
- <<: *bundle_install
7373
- <<: *install_linters
7474

75+
- run:
76+
name: Running commit linters
77+
command: lefthook run commit-linters
78+
7579
- run:
7680
name: Running code style linters
7781
command: lefthook run code-style-linters
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
3+
enableGlobDot: true
4+
5+
patterns:
6+
- name: GithubUser
7+
pattern: /\[@.+\]/gmx
8+
9+
languageSettings:
10+
- languageId: markdown
11+
ignoreRegExpList:
12+
- Email
13+
- GithubUser
14+
15+
words:
16+
- bagage
17+
- bagages
18+
- bestwebua
19+
- changeloglint
20+
- codebases
21+
- codeclimate
22+
- commitspell
23+
- ffaker
24+
- gemspecs
25+
- hostnames
26+
- lefthook
27+
- markdownlint
28+
- mocktools
29+
- mdlrc
30+
- punycode
31+
- rubocop
32+
- representer
33+
- rset
34+
- shortcuting
35+
- simplecov
36+
- simpleidn
37+
- stdlib
38+
- smtpmock
39+
- yamlint

.circleci/linter_configs/.lefthook.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ no_tty: true
44
skip_output:
55
- meta
66

7+
commit-linters:
8+
commands:
9+
commitspell:
10+
run: .circleci/scripts/commitspell.sh -c '.circleci/linter_configs/.commitspell.yml'
11+
712
code-style-linters:
813
commands:
914
reek:

.circleci/scripts/commitspell.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
set -e
3+
4+
configuration=$(if [ "$2" = "" ]; then echo "$2"; else echo " $1 $2"; fi)
5+
latest_commit=$(git rev-parse HEAD)
6+
7+
spellcheck_info() {
8+
echo "Checking the spelling of the latest commit ($latest_commit) message..."
9+
}
10+
11+
compose_cspell_command() {
12+
echo "cspell-cli lint stdin$configuration"
13+
}
14+
15+
cspell="$(compose_cspell_command)"
16+
17+
spellcheck_latest_commit() {
18+
git log -1 --pretty=%B | $cspell
19+
}
20+
21+
spellcheck_info
22+
spellcheck_latest_commit

0 commit comments

Comments
 (0)