Skip to content

Commit

Permalink
Merge branch 'main' into feature/csuzhang_add_contributing.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyuancheung authored Jun 26, 2023
2 parents a027c6e + cb5be8f commit 8d4a7bf
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
16 changes: 16 additions & 0 deletions .chloggen/chloggen-disallow-empty-strings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. crosslink)
component: chloggen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Disallow whitespace-only values

# One or more tracking issues related to the change
issues: [164]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
24 changes: 24 additions & 0 deletions chloggen/cmd/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ func TestValidateE2E(t *testing.T) {
}(),
wantErr: "specify a 'component'",
},
{
name: "empty_component",
entries: func() []*chlog.Entry {
return append(getSampleEntries(), &chlog.Entry{
ChangeType: chlog.BugFix,
Component: " ",
Note: "Add some bar",
Issues: []int{12345},
})
}(),
wantErr: "specify a 'component'",
},
{
name: "missing_note",
entries: func() []*chlog.Entry {
Expand All @@ -68,6 +80,18 @@ func TestValidateE2E(t *testing.T) {
}(),
wantErr: "specify a 'note'",
},
{
name: "empty_note",
entries: func() []*chlog.Entry {
return append(getSampleEntries(), &chlog.Entry{
ChangeType: chlog.BugFix,
Component: "receiver/foo",
Note: " ",
Issues: []int{12345},
})
}(),
wantErr: "specify a 'note'",
},
{
name: "missing_issue",
entries: func() []*chlog.Entry {
Expand Down
4 changes: 2 additions & 2 deletions chloggen/internal/chlog/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ func (e Entry) Validate() error {
return fmt.Errorf("'%s' is not a valid 'change_type'. Specify one of %v", e.ChangeType, changeTypes)
}

if e.Component == "" {
if strings.TrimSpace(e.Component) == "" {
return fmt.Errorf("specify a 'component'")
}

if e.Note == "" {
if strings.TrimSpace(e.Note) == "" {
return fmt.Errorf("specify a 'note'")
}

Expand Down
2 changes: 1 addition & 1 deletion crosslink/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/google/go-cmp v0.5.9
github.com/otiai10/copy v1.11.0
github.com/otiai10/copy v1.12.0
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
Expand Down
4 changes: 2 additions & 2 deletions crosslink/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/otiai10/copy v1.11.0 h1:OKBD80J/mLBrwnzXqGtFCzprFSGioo30JcmR4APsNwc=
github.com/otiai10/copy v1.11.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww=
github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY=
github.com/otiai10/copy v1.12.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww=
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6
github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
github.com/otiai10/copy v1.11.0 h1:OKBD80J/mLBrwnzXqGtFCzprFSGioo30JcmR4APsNwc=
github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
Expand Down

0 comments on commit 8d4a7bf

Please sign in to comment.