Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b28add9

Browse files
authored andcommitted
Feat: show commit msg length (closes #36) (#40)
* Feat: show length of commit msg * Test: update test for commit msg length * Feat: input length for minChar * Test: for new feature show input length * CI: tmp fix, downgrade npm@5.3 on windows
1 parent 270d752 commit b28add9

File tree

4 files changed

+5
-5
lines changed
  • appveyor.yml
  • lib/rules
    • availableRules.js
  • test
    • questions.js
    • rules
      • ruleWarningMessages.js

4 files changed

+5
-5
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install:
1111
- ps: Install-Product node $env:nodejs_version
1212
# install modules
1313
- npm config set loglevel warn
14-
- npm i -g npm
14+
- npm i -g npm@5.3
1515
- npm i
1616

1717
# Post-install test scripts.

lib/rules/availableRules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const rules = {
1010
},
1111
}),
1212
maxChar: (input, config) => ({
13-
message: () => `The commit message is not allowed to be longer as ${config.rules['max-char']}. Consider writing a body.`,
13+
message: () => `The commit message is not allowed to be longer as ${config.rules['max-char']} character, but is ${input.length} character long. Consider writing a body.`,
1414
check: () => {
1515
let number = config.rules['max-char'];
1616

@@ -26,7 +26,7 @@ const rules = {
2626
},
2727
}),
2828
minChar: (input, config) => ({
29-
message: () => `The commit message has to be at least ${config.rules['min-char']} character.`,
29+
message: () => `The commit message has to be at least ${config.rules['min-char']} character, but is only ${input.length} character long.`,
3030
check: () => {
3131
if (input.length < config.rules['min-char']) {
3232
return false;

test/questions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ test('COMMIT | validate functions in questions', (t) => {
112112
const questionsList = questions(config);
113113

114114
t.is(questionsList[2].validate('input text'), true);
115-
t.is(questionsList[2].validate('This message has over 72 characters. So this test will definitely fail. I can guarantee that I am telling the truth'), 'The commit message is not allowed to be longer as 72. Consider writing a body.\n');
115+
t.is(questionsList[2].validate('This message has over 72 characters. So this test will definitely fail. I can guarantee that I am telling the truth'), 'The commit message is not allowed to be longer as 72 character, but is 115 character long. Consider writing a body.\n');
116116
});
117117

118118
test('COMMIT | when and default functions in questions', (t) => {

test/rules/ruleWarningMessages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ test('ruleWarningMessages', (t) => {
1111
},
1212
};
1313
const messages = ruleWaringMessages('input.', config);
14-
t.deepEqual(messages, 'The commit message has to be at least 10 character.\nThe commit message can not end with a dot\n');
14+
t.deepEqual(messages, 'The commit message has to be at least 10 character, but is only 6 character long.\nThe commit message can not end with a dot\n');
1515
});

0 commit comments

Comments
(0)