hasCaptureGroup reports whether `pattern` contains a capturing group -- an unescaped `(` that doesn't begin a non-capturing/extension group `(?...)`.
(pattern string)
| 32 | // hasCaptureGroup reports whether `pattern` contains a capturing group -- an |
| 33 | // unescaped `(` that doesn't begin a non-capturing/extension group `(?...)`. |
| 34 | func hasCaptureGroup(pattern string) bool { |
| 35 | opens := strings.Count(pattern, "(") |
| 36 | noncap := strings.Count(pattern, "(?") + strings.Count(pattern, `\(`) |
| 37 | return opens > noncap |
| 38 | } |
| 39 | |
| 40 | // NewConditional creates a new `conditional`-based rule. |
| 41 | func NewConditional(cfg *core.Config, generic baseCheck, path string) (Conditional, error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…