dotcloud/docker

View on GitHub

Showing 1,885 of 1,885 total issues

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

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

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

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

      func Register(r ipamapi.Registerer, pg plugingetter.PluginGetter, lAddrPools, gAddrPools []*ipamutils.NetworkToSplit) error {
          if err := defaultipam.Register(r, lAddrPools, gAddrPools); err != nil {
              return err
          }
          if err := windowsipam.Register(r); err != nil {
      Severity: Major
      Found in libnetwork/ipams/drivers.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

          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

            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

              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

                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.createNetwork has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (d *driver) createNetwork(config *networkConfiguration) (err error) {
                      // Initialize handle when needed
                      d.Lock()
                      if d.nlh == nil {
                          d.nlh = ns.NlHandle()
                  Severity: Minor
                  Found in libnetwork/drivers/bridge/bridge_linux.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

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

                  func setupIPTablesInternal(ipVer iptables.IPVersion, config *networkConfiguration, addr *net.IPNet, hairpin, enable bool) error {
                      var (
                          address   = addr.String()
                          skipDNAT  = iptRule{ipv: ipVer, table: iptables.Nat, chain: DockerChain, args: []string{"-i", config.BridgeName, "-j", "RETURN"}}
                          outRule   = iptRule{ipv: ipVer, table: iptables.Filter, chain: "FORWARD", args: []string{"-i", config.BridgeName, "!", "-o", config.BridgeName, "-j", "ACCEPT"}}
                  Severity: Major
                  Found in libnetwork/drivers/bridge/setup_ip_tables_linux.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 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 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 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

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

                              func (r *Resolver) forwardExtDNS(ctx context.Context, proto string, remoteAddr net.Addr, query *dns.Msg) *dns.Msg {
                                  ctx, span := otel.Tracer("").Start(ctx, "resolver.forwardExtDNS")
                                  defer span.End()
                              
                                  proxyDNS := r.proxyDNS.Load()
                              Severity: Minor
                              Found in libnetwork/resolver.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 bridgeInterface.programIPv6Addresses has 5 return statements (exceeds 4 allowed).
                              Open

                              func (i *bridgeInterface) programIPv6Addresses(config *networkConfiguration) error {
                                  // Remember the configured addresses.
                                  i.bridgeIPv6 = config.AddressIPv6
                                  i.gatewayIPv6 = config.AddressIPv6.IP
                              
                              
                              Severity: Major
                              Found in libnetwork/drivers/bridge/interface_linux.go - About 35 mins to fix

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

                                func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) (retErr error) {
                                    if ifInfo == nil {
                                        return errors.New("must not be called with nil InterfaceInfo")
                                    }
                                
                                
                                Severity: Minor
                                Found in libnetwork/drivers/remote/driver.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.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

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

                                  func configurePortBindingIPv6(disableNAT bool, bnd types.PortBinding, containerIP, defHostIP net.IP) (portBindingReq, bool) {
                                      if containerIP == nil {
                                          return portBindingReq{}, false
                                      }
                                      if len(bnd.HostIP) > 0 && bnd.HostIP.To4() != nil {
                                  Severity: Major
                                  Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language