feat: remove scope and description in conventional commit

main
hau 2020-11-10 17:07:34 +07:00
parent e6ecf05dd8
commit 063680ab31
6 changed files with 19 additions and 51 deletions

View File

@ -107,10 +107,6 @@ func (a *action) getConventionalCommits(c *cli.Context, commits []git.Commit) []
return conventionalCommits
}
func (a *action) generateMarkdown(c *cli.Context, commits []convention.Commit) error {
return nil
}
func (a *action) log(format string, v ...interface{}) {
if a.verbose {
log.Printf(format, v...)

View File

@ -20,10 +20,8 @@ func TestMarkdownGeneratorGetLines(t *testing.T) {
name: "1 commit feat",
commits: []convention.Commit{
{
RawHeader: "feat: description",
Type: convention.FeatType,
Scope: "",
Description: "description",
RawHeader: "feat: description",
Type: convention.FeatType,
},
},
},
@ -31,10 +29,8 @@ func TestMarkdownGeneratorGetLines(t *testing.T) {
name: "1 commit fixed",
commits: []convention.Commit{
{
RawHeader: "fix: description",
Type: convention.FixType,
Scope: "",
Description: "description",
RawHeader: "fix: description",
Type: convention.FixType,
},
},
},
@ -42,10 +38,8 @@ func TestMarkdownGeneratorGetLines(t *testing.T) {
name: "1 commit other",
commits: []convention.Commit{
{
RawHeader: "ci: description",
Type: convention.CiType,
Scope: "",
Description: "description",
RawHeader: "ci: description",
Type: convention.CiType,
},
},
},
@ -53,28 +47,20 @@ func TestMarkdownGeneratorGetLines(t *testing.T) {
name: "mixed",
commits: []convention.Commit{
{
RawHeader: "feat: description feat",
Type: convention.FeatType,
Scope: "",
Description: "description feat",
RawHeader: "feat: description feat",
Type: convention.FeatType,
},
{
RawHeader: "fix: description fix",
Type: convention.FixType,
Scope: "",
Description: "description fix",
RawHeader: "fix: description fix",
Type: convention.FixType,
},
{
RawHeader: "ci: description ci",
Type: convention.CiType,
Scope: "",
Description: "description ci",
RawHeader: "ci: description ci",
Type: convention.CiType,
},
{
RawHeader: "build: description build",
Type: convention.BuildType,
Scope: "",
Description: "description build",
RawHeader: "build: description build",
Type: convention.BuildType,
},
},
},

View File

@ -18,10 +18,8 @@ var (
)
type Commit struct {
RawHeader string
Type string
Scope string
Description string
RawHeader string
Type string
}
func NewCommit(c git.Commit) (result Commit, err error) {
@ -51,11 +49,5 @@ func parseHeader(header string, commit *Commit) error {
commit.Type = headerSubmatches[1]
commit.Scope = headerSubmatches[2]
commit.Scope = strings.TrimPrefix(commit.Scope, "(")
commit.Scope = strings.TrimSuffix(commit.Scope, ")")
commit.Description = headerSubmatches[4]
return nil
}

View File

@ -1,6 +1,4 @@
{
"RawHeader": "docs: correct spelling of CHANGELOG",
"Type": "docs",
"Scope": "",
"Description": "correct spelling of CHANGELOG"
"Type": "docs"
}

View File

@ -1,6 +1,4 @@
{
"RawHeader": "refactor!: drop support for Node 6",
"Type": "refactor",
"Scope": "",
"Description": "drop support for Node 6"
"Type": "refactor"
}

View File

@ -1,6 +1,4 @@
{
"RawHeader": "feat(lang): add polish language",
"Type": "feat",
"Scope": "lang",
"Description": "add polish language"
"Type": "feat"
}