Skip to content

Commit

Permalink
fix(core): ignore comments
Browse files Browse the repository at this point in the history
* switch to patched fork of conventional-commits-parser
* add test cases for comments
* fixes #78
  • Loading branch information
marionebl committed Nov 2, 2017
1 parent bbab1d8 commit f3beda1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion @commitlint/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@
"xo": "0.18.2"
},
"dependencies": {
"@marionebl/conventional-commits-parser": "^3.0.0",
"@marionebl/git-raw-commits": "^1.2.0",
"@marionebl/sander": "^0.6.0",
"babel-runtime": "^6.23.0",
"chalk": "^2.0.1",
"conventional-changelog-angular": "^1.3.3",
"conventional-commits-parser": "^1.3.0",
"cosmiconfig": "^3.0.1",
"find-up": "^2.1.0",
"lodash": "^4.17.4",
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/core/src/library/parse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {sync} from 'conventional-commits-parser';
import {sync} from '@marionebl/conventional-commits-parser';
import defaultChangelogOpts from 'conventional-changelog-angular';

export default parse;
Expand Down
16 changes: 16 additions & 0 deletions @commitlint/core/src/library/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,19 @@ test('supports scopes with /', async t => {
t.is(actual.scope, 'some/scope');
t.is(actual.subject, 'subject');
});

test('ignores comments', async t => {
const message = 'type(some/scope): subject\n# some comment';
const actual = await parse(message);
t.is(actual.body, null);
t.is(actual.footer, null);
t.is(actual.subject, 'subject');
});

test('registers inline #', async t => {
const message =
'type(some/scope): subject #reference\n# some comment\nthings #reference';
const actual = await parse(message);
t.is(actual.subject, 'subject #reference');
t.is(actual.body, 'things #reference');
});
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@
dependencies:
arrify "^1.0.1"

"@marionebl/conventional-commits-parser@^3.0.0":
version "3.0.0"
resolved "https://registry.npmjs.org/@marionebl/conventional-commits-parser/-/conventional-commits-parser-3.0.0.tgz#9da29b4d2c8f05c0f9cdd02936713b8096c958d3"
dependencies:
JSONStream "^1.0.4"
is-text-path "^1.0.0"
lodash "^4.2.1"
meow "^3.3.0"
split2 "^2.0.0"
through2 "^2.0.0"
trim-off-newlines "^1.0.0"

"@marionebl/git-raw-commits@^1.2.0":
version "1.2.0"
resolved "https://registry.npmjs.org/@marionebl/git-raw-commits/-/git-raw-commits-1.2.0.tgz#7cd8a6dfc09a96df98d8fbe9175c5971cc07c82b"
Expand Down Expand Up @@ -1849,18 +1861,6 @@ conventional-commits-filter@^1.0.0:
is-subset "^0.1.1"
modify-values "^1.0.0"

conventional-commits-parser@^1.3.0:
version "1.3.0"
resolved "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-1.3.0.tgz#e327b53194e1a7ad5dc63479ee9099a52b024865"
dependencies:
JSONStream "^1.0.4"
is-text-path "^1.0.0"
lodash "^4.2.1"
meow "^3.3.0"
split2 "^2.0.0"
through2 "^2.0.0"
trim-off-newlines "^1.0.0"

conventional-commits-parser@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.0.0.tgz#71d01910cb0a99aeb20c144e50f81f4df3178447"
Expand Down

0 comments on commit f3beda1

Please sign in to comment.