Skip to content

Commit eea72b6

Browse files
committed
commitlint.config: reject words in the middle
1 parent 5478dc4 commit eea72b6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

commitlint.config.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,18 @@ module.exports = {
9191
let colonFirstIndex = headerStr.indexOf(":");
9292
let titleStartIndex = Math.max(0, colonFirstIndex + 1);
9393
let title = headerStr.substring(titleStartIndex, headerStr.length).trim();
94-
let firstWordInTitle = title.split(' ')[0];
95-
offence = obviousWords.includes(firstWordInTitle);
94+
let titleWords = title.split(' ');
95+
let usedObviousWords = '';
96+
for (let word of titleWords) {
97+
if (obviousWords.includes(word)) {
98+
offence = true;
99+
usedObviousWords = usedObviousWords + ', ' + word
100+
}
101+
}
96102

97103
return [
98104
!offence,
99-
`Please don't use obvious words such as ${firstWordInTitle} in the commit title`
105+
`Please don't use obvious words such as ${usedObviousWords} in the commit title`
100106
];
101107
},
102108

0 commit comments

Comments
 (0)