MCPcopy Create free account
hub / github.com/idank/explainshell / countHits

Function countHits

prod/botshed/module.go:240–251  ·  view source on GitHub ↗
(cmd string, bn map[string]struct{})

Source from the content-addressed store, hash-verified

238}
239
240func countHits(cmd string, bn map[string]struct{}) int {
241 fields := strings.FieldsFunc(cmd, func(r rune) bool {
242 return strings.ContainsRune(tokenSep, r)
243 })
244 hits := 0
245 for _, f := range fields {
246 if _, ok := bn[f]; ok {
247 hits++
248 }
249 }
250 return hits
251}
252
253func fnv32(s string) uint32 {
254 h := fnv.New32a()

Callers 2

shouldShedFunction · 0.85
TestCountHitsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestCountHitsFunction · 0.68