github.com/prebid/prebid-server/v2@v2.18.0/.semgrep/adapter/bid-type-switch-check.go (about) 1 /* 2 bid-type-switch-check tests 3 https://semgrep.dev/docs/writing-rules/testing-rules 4 "ruleid" prefix in comment indicates patterns that should be flagged by semgrep 5 "ok" prefix in comment indidcates patterns that should not be flagged by the semgrep 6 */ 7 8 // ruleid: bid-type-switch-check 9 switch bidExt.AdCodeType { 10 case "banner": 11 return openrtb_ext.BidTypeBanner, nil 12 case "native": 13 return openrtb_ext.BidTypeNative, nil 14 case "video": 15 return openrtb_ext.BidTypeVideo, nil 16 } 17 18 // ruleid: bid-type-switch-check 19 switch impExt.Adot.MediaType { 20 case string(openrtb_ext.BidTypeBanner): 21 return openrtb_ext.BidTypeBanner, nil 22 case string(openrtb_ext.BidTypeVideo): 23 return openrtb_ext.BidTypeVideo, nil 24 case string(openrtb_ext.BidTypeNative): 25 return openrtb_ext.BidTypeNative, nil 26 } 27 28 // ok: bid-type-switch-check 29 switch bid.MType { 30 case "banner": 31 return openrtb_ext.BidTypeBanner, nil 32 case "native": 33 return openrtb_ext.BidTypeNative, nil 34 case "video": 35 return openrtb_ext.BidTypeVideo, nil 36 }