From c94c4dc44a9e8291af48be0108e68beaad6332b8 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Tue, 26 Dec 2017 19:48:42 +0100 Subject: [PATCH] fix: ignore branch merges with newlines (#214) * fix: ignore branch merges with newlines * fix: remove stray console.log --- @commitlint/is-ignored/src/index.js | 2 +- @commitlint/is-ignored/src/index.test.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/@commitlint/is-ignored/src/index.js b/@commitlint/is-ignored/src/index.js index 9ef99f7220..1dda24cb4b 100644 --- a/@commitlint/is-ignored/src/index.js +++ b/@commitlint/is-ignored/src/index.js @@ -3,7 +3,7 @@ import semver from 'semver'; const WILDCARDS = [ c => c.match( - /^(Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?))$)/ + /^(Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?))(?:\r?\n)?$)/ ), c => c.match(/^(R|r)evert (.*)/), c => c.match(/^(fixup|squash)!/), diff --git a/@commitlint/is-ignored/src/index.test.js b/@commitlint/is-ignored/src/index.test.js index 5ee03b355f..f5646f11fe 100644 --- a/@commitlint/is-ignored/src/index.test.js +++ b/@commitlint/is-ignored/src/index.test.js @@ -47,6 +47,11 @@ test('should return true for branch merges', t => { t.true(isIgnored("Merge branch 'iss53'")); }); +test('should return true for branch merges with newline characters', t => { + t.true(isIgnored("Merge branch 'ctrom-YarnBuild'\n")); + t.true(isIgnored("Merge branch 'ctrom-YarnBuild'\r\n")); +}); + test('should return true for merged PRs', t => { t.true(isIgnored('Merge pull request #369')); });