MCPcopy Create free account
hub / github.com/diillson/chatcli / hasCodeStructures

Function hasCodeStructures

cli/agent_command_blocks.go:1082–1102  ·  view source on GitHub ↗

hasCodeStructures detecta estruturas de código

(content string)

Source from the content-addressed store, hash-verified

1080
1081// hasCodeStructures detecta estruturas de código
1082func hasCodeStructures(content string) bool {
1083 codePatterns := []string{
1084 "try\\s*{", "catch\\s*\\(", "function\\s+\\w+\\s*\\(", "=>\\s*{",
1085 "import\\s+[\\w{}\\s]+from", "export\\s+", "class\\s+\\w+",
1086 "if\\s*\\(.+\\)\\s*{", "for\\s*\\(.+\\)\\s*{", "while\\s*\\(.+\\)\\s*{",
1087 "switch\\s*\\(.+\\)\\s*{", "\\}\\s*else\\s*\\{",
1088 "};", "});", "});",
1089 }
1090
1091 for _, pattern := range codePatterns {
1092 matched, _ := regexp.MatchString(pattern, content)
1093 if matched {
1094 return true
1095 }
1096 }
1097
1098 openBraces := strings.Count(content, "{")
1099 closeBraces := strings.Count(content, "}")
1100
1101 return openBraces > 1 && closeBraces > 1
1102}

Callers 2

askUserIfInteractiveMethod · 0.85
mightBeInteractiveFunction · 0.85

Calls 1

CountMethod · 0.65

Tested by

no test coverage detected