diff --git a/pkg/analyzer/commit_analyzer.go b/pkg/analyzer/commit_analyzer.go index ec18659..cfc725e 100644 --- a/pkg/analyzer/commit_analyzer.go +++ b/pkg/analyzer/commit_analyzer.go @@ -8,7 +8,7 @@ import ( ) var CAVERSION = "dev" -var commitPattern = regexp.MustCompile(`^(\w*)(!)?(?:\((.*)\))?\: (.*)$`) +var commitPattern = regexp.MustCompile(`^(\w*)(?:\((.*)\))?(\!)?\: (.*)$`) var breakingPattern = regexp.MustCompile("BREAKING CHANGES?") type DefaultCommitAnalyzer struct{} @@ -34,8 +34,8 @@ func (da *DefaultCommitAnalyzer) analyzeSingleCommit(rawCommit *semrel.RawCommit return c } c.Type = strings.ToLower(found[0][1]) - breakingChange := found[0][2] - c.Scope = found[0][3] + c.Scope = found[0][2] + breakingChange := found[0][3] c.Message = found[0][4] isMajorChange := breakingPattern.MatchString(rawCommit.RawMessage) diff --git a/pkg/analyzer/commit_analyzer_test.go b/pkg/analyzer/commit_analyzer_test.go index 74911d0..43ca160 100644 --- a/pkg/analyzer/commit_analyzer_test.go +++ b/pkg/analyzer/commit_analyzer_test.go @@ -71,9 +71,9 @@ func TestDefaultAnalyzer(t *testing.T) { &semrel.Change{Major: true, Minor: false, Patch: false}, }, { - createRawCommit("g", "refactor!: drop support for Node 6\n\nBREAKING CHANGE: refactor to use JavaScript features not available in Node 6."), + createRawCommit("g", "refactor(parser)!: drop support for Node 6\n\nBREAKING CHANGE: refactor to use JavaScript features not available in Node 6."), "refactor", - "", + "parser", &semrel.Change{Major: true, Minor: false, Patch: false}, }, {