dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method Controller.NewSandbox has 7 return statements (exceeds 4 allowed).
Open

func (c *Controller) NewSandbox(ctx context.Context, containerID string, options ...SandboxOption) (_ *Sandbox, retErr error) {
    if containerID == "" {
        return nil, types.InvalidParameterErrorf("invalid container ID")
    }

Severity: Major
Found in libnetwork/controller.go - About 45 mins to fix

    Method Sandbox.resolveName has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (sb *Sandbox) resolveName(ctx context.Context, nameOrAlias string, networkName string, epList []*Endpoint, lookupAlias bool, ipType int) (_ []net.IP, ipv6Miss bool) {
    Severity: Minor
    Found in libnetwork/sandbox.go - About 45 mins to fix

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

      func New(cfgOptions ...config.Option) (*Controller, error) {
          cfg := config.New(cfgOptions...)
          store, err := datastore.New(cfg.DataDir, cfg.DatastoreBucket)
          if err != nil {
              return nil, fmt.Errorf("libnet controller initialization: %w", err)
      Severity: Major
      Found in libnetwork/controller.go - About 45 mins to fix

        Method Controller.addEndpointNameResolution has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (c *Controller) addEndpointNameResolution(svcName, svcID, nID, eID, containerName string, vip net.IP, serviceAliases, taskAliases []string, ip net.IP, addService bool, method string) error {
        Severity: Minor
        Found in libnetwork/service_common.go - About 45 mins to fix

          Method PortAllocator.RequestPortsInRange has 7 return statements (exceeds 4 allowed).
          Open

          func (p *PortAllocator) RequestPortsInRange(ips []net.IP, proto string, portStart, portEnd int) (int, error) {
              if proto != "tcp" && proto != "udp" && proto != "sctp" {
                  return 0, ErrUnknownProtocol
              }
          
          
          Severity: Major
          Found in libnetwork/portallocator/portallocator.go - About 45 mins to fix

            Method IPAMData.Validate has 7 return statements (exceeds 4 allowed).
            Open

            func (i *IPAMData) Validate() error {
                var isV6 bool
                if i.Pool == nil {
                    return types.InvalidParameterErrorf("invalid pool")
                }
            Severity: Major
            Found in libnetwork/driverapi/ipamdata.go - About 45 mins to fix

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

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

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

                func (d *driver) configure(option map[string]interface{}) error {
                    var (
                        config            configuration
                        err               error
                        natChain          *iptables.ChainInfo
                Severity: Minor
                Found in libnetwork/drivers/bridge/bridge_linux.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

                Method driver.NetworkAllocate has 7 return statements (exceeds 4 allowed).
                Open

                func (d *driver) NetworkAllocate(id string, option map[string]string, ipV4Data, ipV6Data []driverapi.IPAMData) (map[string]string, error) {
                    if id == "" {
                        return nil, fmt.Errorf("invalid network id for overlay network")
                    }
                
                
                Severity: Major
                Found in libnetwork/drivers/overlay/ovmanager/ovmanager.go - About 45 mins to fix

                  Method Endpoint.DriverInfo has 7 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_windows.go - About 45 mins to fix

                    Method networkConfiguration.Validate has 7 return statements (exceeds 4 allowed).
                    Open

                    func (c *networkConfiguration) Validate() error {
                        if c.Mtu < 0 {
                            return ErrInvalidMtu(c.Mtu)
                        }
                    
                    
                    Severity: Major
                    Found in libnetwork/drivers/bridge/bridge_linux.go - About 45 mins to fix

                      Method PortMapper.MapRange has 7 return statements (exceeds 4 allowed).
                      Open

                      func (pm *PortMapper) MapRange(container net.Addr, hostIP net.IP, hostPortStart, hostPortEnd int) (host net.Addr, retErr error) {
                          pm.lock.Lock()
                          defer pm.lock.Unlock()
                      
                          var (
                      Severity: Major
                      Found in libnetwork/portmapper/mapper.go - About 45 mins to fix

                        Method driver.EventNotify has 7 return statements (exceeds 4 allowed).
                        Open

                        func (d *driver) EventNotify(etype driverapi.EventType, nid, tableName, key string, value []byte) {
                            if tableName != ovPeerTable {
                                log.G(context.TODO()).Errorf("Unexpected table notification for table %s received", tableName)
                                return
                            }
                        Severity: Major
                        Found in libnetwork/drivers/overlay/joinleave.go - About 45 mins to fix

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

                          func NewPortDriverClient(ctx context.Context) (*PortDriverClient, error) {
                              stateDir := os.Getenv("ROOTLESSKIT_STATE_DIR")
                              if stateDir == "" {
                                  return nil, errors.New("$ROOTLESSKIT_STATE_DIR needs to be set")
                              }
                          Severity: Major
                          Found in libnetwork/drivers/bridge/internal/rlkclient/rootlesskit_client_linux.go - About 45 mins to fix

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

                            func (nDB *NetworkDB) gossip() {
                                networkNodes := make(map[string][]string)
                                nDB.RLock()
                                thisNodeNetworks := nDB.networks[nDB.config.NodeID]
                                for nid := range thisNodeNetworks {
                            Severity: Minor
                            Found in libnetwork/networkdb/cluster.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

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

                            func createVlanLink(parentName string) error {
                                if strings.Contains(parentName, ".") {
                                    parent, vidInt, err := parseVlan(parentName)
                                    if err != nil {
                                        return err
                            Severity: Major
                            Found in libnetwork/drivers/macvlan/macvlan_setup.go - About 45 mins to fix

                              Method driver.CreateNetwork has 7 return statements (exceeds 4 allowed).
                              Open

                              func (d *driver) CreateNetwork(nid string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
                                  // reject a null v4 network if ipv4 is required
                                  if v, ok := option[netlabel.EnableIPv4]; ok && v.(bool) {
                                      if len(ipV4Data) == 0 || ipV4Data[0].Pool.String() == "0.0.0.0/0" {
                                          return errdefs.InvalidParameter(fmt.Errorf("ipv4 pool is empty"))
                              Severity: Major
                              Found in libnetwork/drivers/macvlan/macvlan_network.go - About 45 mins to fix

                                Method Client.ImagePush has 7 return statements (exceeds 4 allowed).
                                Open

                                func (cli *Client) ImagePush(ctx context.Context, image string, options image.PushOptions) (io.ReadCloser, error) {
                                    ref, err := reference.ParseNormalizedNamed(image)
                                    if err != nil {
                                        return nil, err
                                    }
                                Severity: Major
                                Found in client/image_push.go - About 45 mins to fix

                                  Method Client.PluginInstall has 7 return statements (exceeds 4 allowed).
                                  Open

                                  func (cli *Client) PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (rc io.ReadCloser, err error) {
                                      query := url.Values{}
                                      if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil {
                                          return nil, errors.Wrap(err, "invalid remote reference")
                                      }
                                  Severity: Major
                                  Found in client/plugin_install.go - About 45 mins to fix

                                    Method Client.imageBuildOptionsToQuery has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    func (cli *Client) imageBuildOptionsToQuery(ctx context.Context, options types.ImageBuildOptions) (url.Values, error) {
                                        query := url.Values{
                                            "t":           options.Tags,
                                            "securityopt": options.SecurityOpt,
                                            "extrahosts":  options.ExtraHosts,
                                    Severity: Minor
                                    Found in client/image_build.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language