Skip to content

Commit d27152d

Browse files
committed
Apply ignoreCommitPattern earlier in the parsing logic
Fixes #195 Sort of fixes #187 too
1 parent 44e8085 commit d27152d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/commits.js

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const parseCommits = (string, options = {}) => {
3535
.split(COMMIT_SEPARATOR)
3636
.slice(1)
3737
.map(commit => parseCommit(commit, options))
38+
.filter(commit => filterCommit(commit, options))
3839
}
3940

4041
const parseCommit = (commit, options = {}) => {
@@ -133,6 +134,13 @@ const getMerge = (commit, message, options = {}) => {
133134
return null
134135
}
135136

137+
const filterCommit = (commit, { ignoreCommitPattern }) => {
138+
if (ignoreCommitPattern && new RegExp(ignoreCommitPattern).test(commit.subject)) {
139+
return false
140+
}
141+
return true
142+
}
143+
136144
module.exports = {
137145
COMMIT_SEPARATOR,
138146
MESSAGE_SEPARATOR,

src/releases.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const parseReleases = async (tags, options, onParsed) => {
1313
const { message } = commits[0] || { message: null }
1414
const breakingCount = commits.filter(c => c.breaking).length
1515
const filteredCommits = commits
16-
.filter(filterCommits(options, merges))
16+
.filter(filterCommits(merges))
1717
.sort(sortCommits(options))
1818
.slice(0, getCommitLimit(options, emptyRelease, breakingCount))
1919

@@ -29,17 +29,14 @@ const parseReleases = async (tags, options, onParsed) => {
2929
}))
3030
}
3131

32-
const filterCommits = ({ ignoreCommitPattern }, merges) => commit => {
32+
const filterCommits = merges => commit => {
3333
if (commit.fixes || commit.merge) {
3434
// Filter out commits that already appear in fix or merge lists
3535
return false
3636
}
3737
if (commit.breaking) {
3838
return true
3939
}
40-
if (ignoreCommitPattern && new RegExp(ignoreCommitPattern).test(commit.subject)) {
41-
return false
42-
}
4340
if (semver.valid(commit.subject)) {
4441
// Filter out version commits
4542
return false

0 commit comments

Comments
 (0)