ext/xnet/dnsclient.go
Function IsDomainName
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
func IsDomainName(s string) bool {
// See RFC 1035, RFC 3696.
// Presentation format has dots before every label except the first, and the
// terminal empty label is optional here because we assume fully-qualified
// (absolute) input. We must therefore reserve space for the first and last
- 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
comment on exported function IsDomainName should be of the form "IsDomainName ..." Open
Open
// Source: https://golang.org/src/net/dnsclient.go
- Exclude checks
Your code does not pass gofmt in 1 place. Go fmt your code! Open
Open
// Package xnet Copyright 2009 The Go Authors. All rights reserved.
- Exclude checks