Skip to content

Commit 56af72c

Browse files
fix(lint): resolve contacts lint failures in CI
1 parent 5ff9ce5 commit 56af72c

3 files changed

Lines changed: 10 additions & 16 deletions

File tree

internal/cmd/contacts.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,6 @@ func primaryOrganization(p *people.Person) (name, title string) {
177177
return p.Organizations[0].Name, p.Organizations[0].Title
178178
}
179179

180-
func primaryURL(p *people.Person) string {
181-
if p == nil || len(p.Urls) == 0 || p.Urls[0] == nil {
182-
return ""
183-
}
184-
return p.Urls[0].Value
185-
}
186-
187180
func allURLs(p *people.Person) []string {
188181
if p == nil || len(p.Urls) == 0 {
189182
return nil

internal/cmd/contacts_crud.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,12 @@ func (c *ContactsGetCmd) Run(ctx context.Context, flags *RootFlags) error {
166166
u.Out().Printf("birthday\t%s", bd)
167167
}
168168
if org, title := primaryOrganization(p); org != "" || title != "" {
169-
if org != "" && title != "" {
169+
switch {
170+
case org != "" && title != "":
170171
u.Out().Printf("organization\t%s (%s)", org, title)
171-
} else if org != "" {
172+
case org != "":
172173
u.Out().Printf("organization\t%s", org)
173-
} else {
174+
default:
174175
u.Out().Printf("title\t%s", title)
175176
}
176177
}
@@ -448,11 +449,11 @@ func (c *ContactsUpdateCmd) Run(ctx context.Context, kctx *kong.Context, flags *
448449
updateFields = append(updateFields, "biographies")
449450
}
450451
if wantCustom {
451-
userDefined, clear, parseErr := parseCustomUserDefined(c.Custom, true)
452+
userDefined, clearAll, parseErr := parseCustomUserDefined(c.Custom, true)
452453
if parseErr != nil {
453454
return usage(parseErr.Error())
454455
}
455-
if clear {
456+
if clearAll {
456457
existing.UserDefined = nil
457458
} else {
458459
existing.UserDefined = userDefined

internal/cmd/contacts_helpers_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ func TestParseCustomUserDefined_InvalidInput(t *testing.T) {
109109
}
110110

111111
func TestParseCustomUserDefined_ValidInput(t *testing.T) {
112-
fields, clear, err := parseCustomUserDefined([]string{"team=devops", " repo = gog"}, false)
112+
fields, clearAll, err := parseCustomUserDefined([]string{"team=devops", " repo = gog"}, false)
113113
if err != nil {
114114
t.Fatalf("unexpected error: %v", err)
115115
}
116-
if clear {
116+
if clearAll {
117117
t.Fatalf("did not expect clear")
118118
}
119119
if len(fields) != 2 || fields[0].Key != "team" || fields[0].Value != "devops" || fields[1].Key != "repo" || fields[1].Value != "gog" {
@@ -122,11 +122,11 @@ func TestParseCustomUserDefined_ValidInput(t *testing.T) {
122122
}
123123

124124
func TestParseCustomUserDefined_ClearAll(t *testing.T) {
125-
fields, clear, err := parseCustomUserDefined([]string{""}, true)
125+
fields, clearAll, err := parseCustomUserDefined([]string{""}, true)
126126
if err != nil {
127127
t.Fatalf("unexpected error: %v", err)
128128
}
129-
if !clear {
129+
if !clearAll {
130130
t.Fatalf("expected clear")
131131
}
132132
if len(fields) != 0 {

0 commit comments

Comments
 (0)