Skip to content

Commit

Permalink
refactor: change unused group into a non-capturing group
Browse files Browse the repository at this point in the history
  • Loading branch information
thislooksfun committed Jun 16, 2020
1 parent fecbbc9 commit 8438115
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.parse_commit(params)
commit_body = params[:commit_body]
releases = params[:releases]
codepush_friendly = params[:codepush_friendly]
pattern = /^(docs|fix|feat|chore|style|refactor|perf|test)(\((.*)\))?(!?)\: (.*)/
pattern = /^(docs|fix|feat|chore|style|refactor|perf|test)(?:\((.*)\))?(!?)\: (.*)/
breaking_change_pattern = /BREAKING CHANGES?: (.*)/
codepush_pattern = /codepush?: (.*)/

Expand All @@ -32,13 +32,13 @@ def self.parse_commit(params)

unless matched.nil?
type = matched[1]
scope = matched[3]
scope = matched[2]

result[:is_valid] = true
result[:type] = type
result[:scope] = scope
result[:has_exclamation_mark] = matched[4] == '!'
result[:subject] = matched[5]
result[:has_exclamation_mark] = matched[3] == '!'
result[:subject] = matched[4]

unless releases.nil?
result[:release] = releases[type.to_sym]
Expand Down

0 comments on commit 8438115

Please sign in to comment.