dotcloud/docker

View on GitHub
daemon/cluster/listen_addr.go

Summary

Maintainability
C
1 day
Test Coverage

Method Cluster.resolveSystemAddrViaSubnetCheck has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
Open

func (c *Cluster) resolveSystemAddrViaSubnetCheck() (net.IP, error) {
    // Use the system's only IP address, or fail if there are
    // multiple addresses to choose from. Skip interfaces which
    // are managed by docker via subnet check.
    interfaces, err := net.Interfaces()
Severity: Minor
Found in daemon/cluster/listen_addr.go - About 6 hrs 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

Method Cluster.resolveSystemAddrViaSubnetCheck has 62 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *Cluster) resolveSystemAddrViaSubnetCheck() (net.IP, error) {
    // Use the system's only IP address, or fail if there are
    // multiple addresses to choose from. Skip interfaces which
    // are managed by docker via subnet check.
    interfaces, err := net.Interfaces()
Severity: Minor
Found in daemon/cluster/listen_addr.go - About 1 hr to fix

    Method Cluster.resolveSystemAddrViaSubnetCheck has 7 return statements (exceeds 4 allowed).
    Open

    func (c *Cluster) resolveSystemAddrViaSubnetCheck() (net.IP, error) {
        // Use the system's only IP address, or fail if there are
        // multiple addresses to choose from. Skip interfaces which
        // are managed by docker via subnet check.
        interfaces, err := net.Interfaces()
    Severity: Major
    Found in daemon/cluster/listen_addr.go - About 45 mins to fix

      Function resolveInterfaceAddr has 7 return statements (exceeds 4 allowed).
      Open

      func resolveInterfaceAddr(specifiedInterface string) (net.IP, error) {
          // Use a specific interface's IP address.
          intf, err := net.InterfaceByName(specifiedInterface)
          if err != nil {
              return nil, errNoSuchInterface
      Severity: Major
      Found in daemon/cluster/listen_addr.go - About 45 mins to fix

        Method Cluster.resolveAdvertiseAddr has 6 return statements (exceeds 4 allowed).
        Open

        func (c *Cluster) resolveAdvertiseAddr(advertiseAddr, listenAddrPort string) (string, string, error) {
            // Approach:
            // - If an advertise address is specified, use that. Resolve the
            //   interface's address if an interface was specified in
            //   advertiseAddr. Fill in the port from listenAddrPort if necessary.
        Severity: Major
        Found in daemon/cluster/listen_addr.go - About 40 mins to fix

          Function validateDefaultAddrPool has 5 return statements (exceeds 4 allowed).
          Open

          func validateDefaultAddrPool(defaultAddrPool []string, size uint32) error {
              if defaultAddrPool == nil {
                  // defaultAddrPool is not defined
                  return nil
              }
          Severity: Major
          Found in daemon/cluster/listen_addr.go - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status