dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method Endpoint.assignAddressVersion has 5 return statements (exceeds 4 allowed).
Open

func (ep *Endpoint) assignAddressVersion(ipVer int, ipam ipamapi.Ipam) error {
    var (
        poolID  *string
        address **net.IPNet
        prefAdd net.IP
Severity: Major
Found in libnetwork/endpoint.go - About 35 mins to fix

    Method Endpoint.Less has 5 return statements (exceeds 4 allowed).
    Open

    func (epi *Endpoint) Less(epj *Endpoint) bool {
        var prioi, prioj int
    
        sbi, _ := epi.getSandbox()
        sbj, _ := epj.getSandbox()
    Severity: Major
    Found in libnetwork/sandbox.go - About 35 mins to fix

      Method NetworkDB.handleTableEvent has 5 return statements (exceeds 4 allowed).
      Open

      func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent, isBulkSync bool) bool {
          // Update our local clock if the received messages has newer time.
          nDB.tableClock.Witness(tEvent.LTime)
      
          // Ignore the table events for networks that are in the process of going away
      Severity: Major
      Found in libnetwork/networkdb/delegate.go - About 35 mins to fix

        Method ResolvConf.WriteFile has 5 return statements (exceeds 4 allowed).
        Open

        func (rc *ResolvConf) WriteFile(path, hashPath string, perm os.FileMode) error {
            content, err := rc.Generate(true)
            if err != nil {
                return err
            }
        Severity: Major
        Found in libnetwork/internal/resolvconf/resolvconf.go - About 35 mins to fix

          Method NetworkDB.handleTableMessage has 5 return statements (exceeds 4 allowed).
          Open

          func (nDB *NetworkDB) handleTableMessage(buf []byte, isBulkSync bool) {
              var tEvent TableEvent
              if err := proto.Unmarshal(buf, &tEvent); err != nil {
                  log.G(context.TODO()).Errorf("Error decoding table event message: %v", err)
                  return
          Severity: Major
          Found in libnetwork/networkdb/delegate.go - About 35 mins to fix

            Method allocator.RequestPool has 5 return statements (exceeds 4 allowed).
            Open

            func (a *allocator) RequestPool(req ipamapi.PoolRequest) (ipamapi.AllocatedPool, error) {
                if req.AddressSpace != defaultAddressSpace {
                    return ipamapi.AllocatedPool{}, types.InvalidParameterErrorf("unknown address space: %s", req.AddressSpace)
                }
                if req.Pool != "" {
            Severity: Major
            Found in libnetwork/ipams/null/null.go - About 35 mins to fix

              Method IPTable.NewChain has 5 return statements (exceeds 4 allowed).
              Open

              func (iptable IPTable) NewChain(name string, table Table) (*ChainInfo, error) {
                  if name == "" {
                      return nil, fmt.Errorf("could not create chain: chain name is empty")
                  }
                  if table == "" {
              Severity: Major
              Found in libnetwork/iptables/iptables.go - About 35 mins to fix

                Method addrSpace.releaseAddress has 5 return statements (exceeds 4 allowed).
                Open

                func (aSpace *addrSpace) releaseAddress(nw, sub netip.Prefix, address netip.Addr) error {
                    aSpace.mu.Lock()
                    defer aSpace.mu.Unlock()
                
                    p, ok := aSpace.subnets[nw]
                Severity: Major
                Found in libnetwork/ipams/defaultipam/address_space.go - About 35 mins to fix

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

                  func deleteEpFromResolverImpl(
                      epName string,
                      epIface *EndpointInterface,
                      resolvers []*Resolver,
                      hnsEndpoints []hcsshim.HNSEndpoint,
                  Severity: Major
                  Found in libnetwork/network_windows.go - About 35 mins to fix

                    Method Network.Services has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (n *Network) Services() map[string]ServiceInfo {
                        agent, ok := n.clusterAgent()
                        if !ok {
                            return nil
                        }
                    Severity: Minor
                    Found in libnetwork/agent.go - About 35 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

                    Method Endpoint.Info has 5 return statements (exceeds 4 allowed).
                    Open

                    func (ep *Endpoint) Info() EndpointInfo {
                        if ep.sandboxID != "" {
                            return ep
                        }
                        n, err := ep.getNetworkFromStore()
                    Severity: Major
                    Found in libnetwork/endpoint_info.go - About 35 mins to fix

                      Method cache.kmap has 5 return statements (exceeds 4 allowed).
                      Open

                      func (c *cache) kmap(kvObject KVObject) (kvMap, error) {
                          var err error
                      
                          c.mu.Lock()
                          keyPrefix := Key(kvObject.KeyPrefix()...)
                      Severity: Major
                      Found in libnetwork/datastore/cache.go - About 35 mins to fix

                        Method Controller.rmServiceBinding has 5 return statements (exceeds 4 allowed).
                        Open

                        func (c *Controller) rmServiceBinding(svcName, svcID, nID, eID, containerName string, vip net.IP, ingressPorts []*PortConfig, serviceAliases []string, taskAliases []string, ip net.IP, method string, deleteSvcRecords bool, fullRemove bool) error {
                            var rmService bool
                        
                            skey := serviceKey{
                                id:    svcID,
                        Severity: Major
                        Found in libnetwork/service_common.go - About 35 mins to fix

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

                          func DelInterfaceFirewalld(intf string) error {
                              if !firewalldRunning {
                                  return nil
                              }
                          
                          
                          Severity: Major
                          Found in libnetwork/iptables/firewalld.go - About 35 mins to fix

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

                            func GenerateFromModel(options Generic, model interface{}) (interface{}, error) {
                                modType := reflect.TypeOf(model)
                            
                                // If the model is of pointer type, we need to dereference for New.
                                resType := reflect.TypeOf(model)
                            Severity: Major
                            Found in libnetwork/options/options.go - About 35 mins to fix

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

                              func PoolIDFromString(str string) (pID PoolID, err error) {
                                  if str == "" {
                                      return pID, types.InvalidParameterErrorf("invalid string form for subnetkey: %s", str)
                                  }
                              
                              
                              Severity: Major
                              Found in libnetwork/ipams/defaultipam/structures.go - About 35 mins to fix

                                Method NetworkDB.changeNodeState has 5 return statements (exceeds 4 allowed).
                                Open

                                func (nDB *NetworkDB) changeNodeState(nodeName string, newState nodeState) (bool, error) {
                                    n, currState, m := nDB.findNode(nodeName)
                                    if n == nil {
                                        return false, fmt.Errorf("node %s not found", nodeName)
                                    }
                                Severity: Major
                                Found in libnetwork/networkdb/nodemgmt.go - About 35 mins to fix

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

                                  func getDynamicPortRange() (start int, end int, err error) {
                                      portRangeKernelSysctl := []string{"net.inet.ip.portrange.hifirst", "net.ip.portrange.hilast"}
                                      portRangeLowCmd := exec.Command("/sbin/sysctl", portRangeKernelSysctl[0])
                                      var portRangeLowOut bytes.Buffer
                                      portRangeLowCmd.Stdout = &portRangeLowOut
                                  Severity: Major
                                  Found in libnetwork/portallocator/portallocator_freebsd.go - About 35 mins to fix

                                    Method Network.addLBBackend has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (n *Network) addLBBackend(ip net.IP, lb *loadBalancer) {
                                        if len(lb.vip) == 0 {
                                            return
                                        }
                                    
                                    
                                    Severity: Major
                                    Found in libnetwork/service_windows.go - About 35 mins to fix

                                      Method Controller.NetworkByName has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (c *Controller) NetworkByName(name string) (*Network, error) {
                                          if name == "" {
                                              return nil, ErrInvalidName(name)
                                          }
                                          var n *Network
                                      Severity: Major
                                      Found in libnetwork/controller.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language