1
Fork 0

style: reenable switch check

This commit is contained in:
TheFox0x7 2024-07-17 19:19:36 +02:00
parent adf4dcdbbf
commit 8322882265
No known key found for this signature in database
GPG key ID: 6CA33903484AF7C2
19 changed files with 29 additions and 43 deletions

View file

@ -649,8 +649,7 @@ func matchReleaseEvent(payload *api.ReleasePayload, evt *jobparser.Event) bool {
// unpublished, created, deleted, prereleased, released
action := payload.Action
switch action {
case api.HookReleaseUpdated:
if action == api.HookReleaseUpdated {
action = "edited"
}
for _, val := range vals {
@ -686,8 +685,7 @@ func matchPackageEvent(payload *api.PackagePayload, evt *jobparser.Event) bool {
// updated
action := payload.Action
switch action {
case api.HookPackageCreated:
if action == api.HookPackageCreated {
action = "published"
}
for _, val := range vals {

View file

@ -16,8 +16,9 @@ func GetItemByType(typ ap.ActivityVocabularyType) (ap.Item, error) {
switch typ {
case RepositoryType:
return RepositoryNew(""), nil
default:
return ap.GetItemByType(typ)
}
return ap.GetItemByType(typ)
}
// JSONUnmarshalerFn is the function that will load the data from a fastjson.Value into an Item
@ -28,8 +29,9 @@ func JSONUnmarshalerFn(typ ap.ActivityVocabularyType, val *fastjson.Value, i ap.
return OnRepository(i, func(r *Repository) error {
return JSONLoadRepository(val, r)
})
default:
return nil
}
return nil
}
// NotEmpty is the function that checks if an object is empty
@ -44,6 +46,7 @@ func NotEmpty(i ap.Item) bool {
return false
}
return ap.NotEmpty(r.Actor)
default:
return ap.NotEmpty(i)
}
return ap.NotEmpty(i)
}

View file

@ -34,8 +34,7 @@ func (g *GitHubCalloutTransformer) Transform(node *ast.Document, reader text.Rea
return ast.WalkContinue, nil
}
switch v := n.(type) {
case *ast.Blockquote:
if v, ok := n.(*ast.Blockquote); ok {
if v.ChildCount() == 0 {
return ast.WalkContinue, nil
}
@ -91,7 +90,6 @@ func (g *GitHubCalloutTransformer) Transform(node *ast.Document, reader text.Rea
firstParagraph.Parent().InsertBefore(firstParagraph.Parent(), firstParagraph, attentionParagraph)
firstParagraph.RemoveChild(firstParagraph, firstTextNode)
firstParagraph.RemoveChild(firstParagraph, secondTextNode)
firstParagraph.RemoveChild(firstParagraph, thirdTextNode)
}
return ast.WalkContinue, nil
})

View file

@ -23,8 +23,7 @@ func (g *GitHubLegacyCalloutTransformer) Transform(node *ast.Document, reader te
return ast.WalkContinue, nil
}
switch v := n.(type) {
case *ast.Blockquote:
if v, ok := n.(*ast.Blockquote); ok {
if v.ChildCount() == 0 {
return ast.WalkContinue, nil
}

View file

@ -98,8 +98,7 @@ func getLicensePlaceholder(name string) *licensePlaceholder {
// Some special placeholders for specific licenses.
// It's unsafe to apply them to all licenses.
switch name {
case "0BSD":
if name == "0BSD" {
return &licensePlaceholder{
Owner: []string{"AUTHOR"},
Email: []string{"EMAIL"},

View file

@ -122,8 +122,7 @@ func (p *RedisProvider) Init(maxlifetime int64, configs string) (err error) {
uri := nosql.ToRedisURI(configs)
for k, v := range uri.Query() {
switch k {
case "prefix":
if k == "prefix" {
p.prefix = v[0]
}
}

View file

@ -13,8 +13,9 @@ func (taskType TaskType) Name() string {
switch taskType {
case TaskTypeMigrateRepo:
return "Migrate Repository"
default:
return ""
}
return ""
}
// TaskStatus defines task status