Skip to content

Commit dbc34e1

Browse files
authored
Merge PR #129 from parhamsaremi/footer-note-misplacement-false-positive
Fixes #118
2 parents 6482dc7 + e0df7b3 commit dbc34e1

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

commitlint.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ module.exports = {
2727
"always",
2828
footerMaxLineLength,
2929
],
30-
// temporarily disabled because of https://github.com/nblockchain/conventions/issues/118
31-
"footer-notes-misplacement": [RuleConfigSeverity.Disabled, "always"],
30+
"footer-notes-misplacement": [RuleConfigSeverity.Error, "always"],
3231
// temporarily disabled because of https://github.com/nblockchain/conventions/issues/125
3332
"footer-refs-validity": [RuleConfigSeverity.Disabled, "always"],
3433
"header-max-length-with-suggestions": [

commitlint/plugins.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ test("empty-wip-3", () => {
475475
expect(emptyWIP3.status).toBe(0);
476476
});
477477

478-
/* temporarily disabled rule because of https://github.com/nblockchain/conventions/issues/118
479478
test("footer-notes-misplacement-1", () => {
480479
let commitMsgWithRightFooter =
481480
"foo: this is only a title" +
@@ -529,7 +528,17 @@ test("footer-notes-misplacement-4", () => {
529528
let footerNotesMisplacement4 = runCommitLintOnMsg(commitMsgWithWrongFooter);
530529
expect(footerNotesMisplacement4.status).not.toBe(0);
531530
});
532-
*/
531+
532+
test("footer-notes-misplacement-5", () => {
533+
let commitMsgWithRightFooter =
534+
"foo: this is only a title\n\n" +
535+
"Bla bla blah[1]:\n\n" +
536+
"```\nSome error message with a [] in the first of its line\n[warn] some warning\n```\n\n" +
537+
"[1] http://foo.bar/baz";
538+
let footerNotesMisplacement5 = runCommitLintOnMsg(commitMsgWithRightFooter);
539+
console.log(footerNotesMisplacement5.stdout.toString());
540+
expect(footerNotesMisplacement5.status).toBe(0);
541+
});
533542

534543
/* temporarily disabled rule because of https://github.com/nblockchain/conventions/issues/125
535544
test("footer-refs-validity1", () => {

commitlint/plugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export abstract class Plugins {
157157
let offence = false;
158158

159159
if (bodyStr !== null) {
160-
bodyStr = bodyStr.trim();
160+
bodyStr = Helpers.removeAllCodeBlocks(bodyStr).trim();
161161
let seenBody = false;
162162
let seenFooter = false;
163163
let lines = bodyStr.split(/\r?\n/);

0 commit comments

Comments
 (0)