src/go/pkg/matcher/glob.go
Function matchChunk
has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring. Open
Open
func matchChunk(chunk, s string) (rest string, ok bool, err error) {
for len(chunk) > 0 {
if len(s) == 0 {
return
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method globMatcher.globMatch
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
Open
func (m globMatcher) globMatch(name string) (matched bool, err error) {
pattern := string(m)
Pattern:
for len(pattern) > 0 {
var star bool
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function matchChunk
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func matchChunk(chunk, s string) (rest string, ok bool, err error) {
for len(chunk) > 0 {
if len(s) == 0 {
return
}
Function matchChunk
has 8 return statements (exceeds 4 allowed). Open
Open
func matchChunk(chunk, s string) (rest string, ok bool, err error) {
for len(chunk) > 0 {
if len(s) == 0 {
return
}
Avoid deeply nested control flow statements. Open
Open
if hi, chunk, err = getEsc(chunk[1:]); err != nil {
return
}
Avoid deeply nested control flow statements. Open
Open
if len(pattern) == 0 && len(t) > 0 {
continue
}
Method globMatcher.globMatch
has 5 return statements (exceeds 4 allowed). Open
Open
func (m globMatcher) globMatch(name string) (matched bool, err error) {
pattern := string(m)
Pattern:
for len(pattern) > 0 {
var star bool