dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method Sandbox.ResolveName has 5 return statements (exceeds 4 allowed).
Open

func (sb *Sandbox) ResolveName(ctx context.Context, name string, ipType int) ([]net.IP, bool) {
    // Embedded server owns the docker network domain. Resolution should work
    // for both container_name and container_name.network_name
    // We allow '.' in service name and network name. For a name a.b.c.d the
    // following have to tried;
Severity: Major
Found in libnetwork/sandbox.go - About 35 mins to fix

    Method Store.PutObjectAtomic has 5 return statements (exceeds 4 allowed).
    Open

    func (ds *Store) PutObjectAtomic(kvObject KVObject) error {
        ds.mu.Lock()
        defer ds.mu.Unlock()
    
        if kvObject == nil {
    Severity: Major
    Found in libnetwork/datastore/datastore.go - About 35 mins to fix

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

      func (aSpace *addrSpace) requestAddress(nw, sub netip.Prefix, prefAddress netip.Addr, opts map[string]string) (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

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

        func (ep *Endpoint) DriverInfo() (map[string]interface{}, error) {
            ep, err := ep.retrieveFromStore()
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in libnetwork/endpoint_info_unix.go - About 35 mins to fix

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

          func getPluginClient(p plugingetter.CompatPlugin) (*plugins.Client, error) {
              if v1, ok := p.(plugingetter.PluginWithV1Client); ok {
                  return v1.Client(), nil
              }
          
          
          Severity: Major
          Found in libnetwork/drivers/remote/driver.go - About 35 mins to fix

            Method endpoint.UnmarshalJSON has 5 return statements (exceeds 4 allowed).
            Open

            func (ep *endpoint) UnmarshalJSON(b []byte) error {
                var (
                    err   error
                    epMap map[string]interface{}
                )
            Severity: Major
            Found in libnetwork/drivers/macvlan/macvlan_store.go - About 35 mins to fix

              Method driver.CreateEndpoint has 5 return statements (exceeds 4 allowed).
              Open

              func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
                  if err := validateID(nid, eid); err != nil {
                      return err
                  }
                  n, err := d.getNetwork(nid)
              Severity: Major
              Found in libnetwork/drivers/macvlan/macvlan_endpoint.go - About 35 mins to fix

                Method bridgeEndpoint.UnmarshalJSON has 5 return statements (exceeds 4 allowed).
                Open

                func (ep *bridgeEndpoint) UnmarshalJSON(b []byte) error {
                    var (
                        err   error
                        epMap map[string]interface{}
                    )
                Severity: Major
                Found in libnetwork/drivers/bridge/bridge_store.go - About 35 mins to fix

                  Method networkConfiguration.Conflicts has 5 return statements (exceeds 4 allowed).
                  Open

                  func (c *networkConfiguration) Conflicts(o *networkConfiguration) error {
                      if o == nil {
                          return errors.New("same configuration")
                      }
                  
                  
                  Severity: Major
                  Found in libnetwork/drivers/bridge/bridge_linux.go - About 35 mins to fix

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

                    func (nDB *NetworkDB) clusterInit() error {
                        nDB.lastStatsTimestamp = time.Now()
                        nDB.lastHealthTimestamp = nDB.lastStatsTimestamp
                    
                        config := memberlist.DefaultLANConfig()
                    Severity: Major
                    Found in libnetwork/networkdb/cluster.go - About 35 mins to fix

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

                      func configurePortBindingIPv6(
                          ctx context.Context,
                          pdc portDriverClient,
                          disableNAT bool,
                          bnd types.PortBinding,
                      Severity: Major
                      Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 35 mins to fix

                        Method bridgeNetwork.setPerPortIptables has 5 return statements (exceeds 4 allowed).
                        Open

                        func (n *bridgeNetwork) setPerPortIptables(b portBinding, enable bool) error {
                            if (b.IP.To4() != nil) != (b.HostIP.To4() != nil) {
                                // The binding is between containerV4 and hostV6 (not vice-versa as that
                                // will have been rejected earlier). It's handled by docker-proxy, so no
                                // additional iptables rules are required.
                        Severity: Major
                        Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 35 mins to fix

                          Method driver.configure has 5 return statements (exceeds 4 allowed).
                          Open

                          func (d *driver) configure(option map[string]interface{}) error {
                              var (
                                  config            configuration
                                  err               error
                                  natChain          *iptables.ChainInfo
                          Severity: Major
                          Found in libnetwork/drivers/bridge/bridge_linux.go - About 35 mins to fix

                            Method driver.createNetwork has 5 return statements (exceeds 4 allowed).
                            Open

                            func (d *driver) createNetwork(config *configuration) (bool, error) {
                                foundExisting := false
                                networkList := d.getNetworks()
                                for _, nw := range networkList {
                                    if config.Parent == nw.config.Parent {
                            Severity: Major
                            Found in libnetwork/drivers/macvlan/macvlan_network.go - About 35 mins to fix

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

                              func createMacVlan(containerIfName, parent, macvlanMode string) (string, error) {
                                  // Set the macvlan mode. Default is bridge mode
                                  mode, err := setMacVlanMode(macvlanMode)
                                  if err != nil {
                                      return "", fmt.Errorf("Unsupported %s macvlan mode: %v", macvlanMode, err)
                              Severity: Major
                              Found in libnetwork/drivers/macvlan/macvlan_setup.go - About 35 mins to fix

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

                                func delVlanLink(linkName string) error {
                                    if strings.Contains(linkName, ".") {
                                        _, _, err := parseVlan(linkName)
                                        if err != nil {
                                            return err
                                Severity: Major
                                Found in libnetwork/drivers/macvlan/macvlan_setup.go - About 35 mins to fix

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

                                  func bindSCTP(cfg portBindingReq, port int) (_ portBinding, retErr error) {
                                      pb := portBinding{PortBinding: cfg.GetCopy()}
                                      pb.HostPort = uint16(port)
                                      pb.HostPortEnd = pb.HostPort
                                      pb.childHostIP = cfg.childHostIP
                                  Severity: Major
                                  Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 35 mins to fix

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

                                    func (nDB *NetworkDB) bulkSyncTables() {
                                        var networks []string
                                        nDB.RLock()
                                        for nid, network := range nDB.networks[nDB.config.NodeID] {
                                            if network.leaving {
                                    Severity: Minor
                                    Found in libnetwork/networkdb/cluster.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 driver.Leave has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (d *driver) Leave(nid, eid string) error {
                                        network, err := d.getNetwork(nid)
                                        if err != nil {
                                            return types.InternalMaskableErrorf("%s", err)
                                        }
                                    Severity: Major
                                    Found in libnetwork/drivers/bridge/bridge_linux.go - About 35 mins to fix

                                      Method driver.RevokeExternalConnectivity has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (d *driver) RevokeExternalConnectivity(nid, eid string) error {
                                          network, err := d.getNetwork(nid)
                                          if err != nil {
                                              return err
                                          }
                                      Severity: Major
                                      Found in libnetwork/drivers/bridge/bridge_linux.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language