mesg-foundation/core

View on GitHub
ext/xnet/dnsclient.go

Summary

Maintainability
A
45 mins
Test Coverage

Function IsDomainName has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
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
Severity: Minor
Found in ext/xnet/dnsclient.go - About 45 mins to fix

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

// Source: https://golang.org/src/net/dnsclient.go
Severity: Minor
Found in ext/xnet/dnsclient.go by golint

Your code does not pass gofmt in 1 place. Go fmt your code!
Open

// Package xnet Copyright 2009 The Go Authors. All rights reserved.
Severity: Minor
Found in ext/xnet/dnsclient.go by gofmt

There are no issues that match your filters.

Category
Status