You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.error('git-commit-hook: config.lineLength is suppose to be number, remove the rule or set to 0 if you don\'t want to force it');
68
+
this.stop();
69
+
}elseif(config.lineLength){
70
+
this.config.lineLength=config.lineLength;
71
+
}
72
+
}
73
+
74
+
// Check length of every line of commit message and validate that there are no long lines in it
75
+
checkLength(){
76
+
// Start line with number one, to make it less confusing
77
+
letline=1;
78
+
79
+
for(constmessageofthis.message){
80
+
// If line is longer than allowed, show error message and exit the process
81
+
if(message.length>this.config.lineLength){
82
+
console.error(`git-commit-hook: Commit message in line ${line} have more characters than allowed in a single line, please break it down, maximum is ${this.config.lineLength}`);
83
+
returnfalse;
84
+
}
85
+
86
+
line++;
87
+
}
88
+
}
89
+
90
+
// Check first line of commit message, if there is [Type]([optional scope]): [Subject]
91
+
// Semicolon with space is always mandatory after the Type
53
92
checkTypeSubject(){
54
93
consttypes=this.config.types.join('|');
55
94
letregStr=`(${types})(\(.*\))?\\:`;
56
95
constregExpType=newRegExp(regStr);
57
96
97
+
// Check type and semicolon
58
98
if(this.message[0].search(regExpType)===-1){
59
99
console.error(`git-commit-hook: Type should follow the rules "${types}(scope/filename): Subject"`);
60
100
returnfalse;
@@ -63,6 +103,7 @@ class gitCommitMsg {
63
103
regStr+=' .*';
64
104
constregExpSubject=newRegExp(regStr);
65
105
106
+
// Check if there is subject after semicolon
66
107
if(this.message[0].search(regExpSubject)===-1){
67
108
console.error('git-commit-hook: Subject is not set or there is no space after semicolon');
0 commit comments