dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

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

func (d *driver) createNetwork(config *networkConfiguration) (err error) {
    // Initialize handle when needed
    d.Lock()
    if d.nlh.Handle == nil {
        d.nlh = ns.NlHandle()
Severity: Major
Found in libnetwork/drivers/bridge/bridge_linux.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 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 Client.ConfigInspectWithRaw has 5 return statements (exceeds 4 allowed).
    Open

    func (cli *Client) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.Config, []byte, error) {
        if id == "" {
            return swarm.Config{}, nil, objectNotFoundError{object: "config", id: id}
        }
        if err := cli.NewVersionError(ctx, "1.30", "config inspect"); err != nil {
    Severity: Major
    Found in client/config_inspect.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/ipvlan/ipvlan_store.go - About 35 mins to fix

        Method Client.VolumesPrune has 5 return statements (exceeds 4 allowed).
        Open

        func (cli *Client) VolumesPrune(ctx context.Context, pruneFilters filters.Args) (volume.PruneReport, error) {
            if err := cli.NewVersionError(ctx, "1.25", "volume prune"); err != nil {
                return volume.PruneReport{}, err
            }
        
        
        Severity: Major
        Found in client/volume_prune.go - About 35 mins to fix

          Method Client.SecretInspectWithRaw has 5 return statements (exceeds 4 allowed).
          Open

          func (cli *Client) SecretInspectWithRaw(ctx context.Context, id string) (swarm.Secret, []byte, error) {
              if err := cli.NewVersionError(ctx, "1.25", "secret inspect"); err != nil {
                  return swarm.Secret{}, nil, err
              }
              if id == "" {
          Severity: Major
          Found in client/secret_inspect.go - About 35 mins to fix

            Method Client.NetworksPrune has 5 return statements (exceeds 4 allowed).
            Open

            func (cli *Client) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (network.PruneReport, error) {
                if err := cli.NewVersionError(ctx, "1.25", "network prune"); err != nil {
                    return network.PruneReport{}, err
                }
            
            
            Severity: Major
            Found in client/network_prune.go - About 35 mins to fix

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

              func Exec(ctx context.Context, apiClient client.APIClient, id string, cmd []string, ops ...func(*container.ExecOptions)) (ExecResult, error) {
                  // prepare exec
                  execOptions := container.ExecOptions{
                      AttachStdout: true,
                      AttachStderr: true,
              Severity: Major
              Found in integration/internal/container/exec.go - About 35 mins to fix

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

                func makePluginAdapter(p plugingetter.CompatPlugin) (*volumeDriverAdapter, error) {
                    if pc, ok := p.(plugingetter.PluginWithV1Client); ok {
                        return &volumeDriverAdapter{name: p.Name(), scopePath: p.ScopedPath, proxy: &volumeDriverProxy{pc.Client()}}, nil
                    }
                
                
                Severity: Major
                Found in volume/drivers/extpoint.go - About 35 mins to fix

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

                  func ConvertPortBindings(portBindings []types.PortBinding) ([]json.RawMessage, error) {
                      var pbs []json.RawMessage
                  
                      // Enumerate through the port bindings specified by the user and convert
                      // them into the internal structure matching the JSON blob that can be
                  Severity: Major
                  Found in libnetwork/drivers/windows/windows.go - About 35 mins to fix

                    Method Provider.NewAllocator has 5 return statements (exceeds 4 allowed).
                    Open

                    func (p *Provider) NewAllocator(netConfig *networkallocator.Config) (networkallocator.NetworkAllocator, error) {
                        na := &cnmNetworkAllocator{
                            networks: make(map[string]*network),
                            services: make(map[string]struct{}),
                            tasks:    make(map[string]struct{}),
                    Severity: Major
                    Found in libnetwork/cnmallocator/networkallocator.go - About 35 mins to fix

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

                      func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
                          log.G(context.TODO()).Infof("WINOVERLAY: Enter peerDelete for endpoint %s and peer ip %s", eid, peerIP.String())
                      
                          if err := validateID(nid, eid); err != nil {
                              return err
                      Severity: Major
                      Found in libnetwork/drivers/windows/overlay/peerdb_windows.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/ipvlan/ipvlan_setup.go - About 35 mins to fix

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

                          func (sb *Sandbox) setupDefaultGW() error {
                              // check if the container already has a GW endpoint
                              if ep := sb.getEndpointInGWNetwork(); ep != nil {
                                  return nil
                              }
                          Severity: Major
                          Found in libnetwork/default_gateway.go - About 35 mins to fix

                            Method Client.PluginUpgrade has 5 return statements (exceeds 4 allowed).
                            Open

                            func (cli *Client) PluginUpgrade(ctx context.Context, name string, options types.PluginInstallOptions) (rc io.ReadCloser, err error) {
                                if err := cli.NewVersionError(ctx, "1.26", "plugin upgrade"); err != nil {
                                    return nil, err
                                }
                                query := url.Values{}
                            Severity: Major
                            Found in client/plugin_upgrade.go - About 35 mins to fix

                              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 Client.ContainerWait has 5 return statements (exceeds 4 allowed).
                                Open

                                func (cli *Client) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error) {
                                    resultC := make(chan container.WaitResponse)
                                    errC := make(chan error, 1)
                                
                                    // Make sure we negotiated (if the client is configured to do so),
                                Severity: Major
                                Found in client/container_wait.go - About 35 mins to fix

                                  Method cnmNetworkAllocator.Allocate has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (na *cnmNetworkAllocator) Allocate(n *api.Network) error {
                                      if _, ok := na.networks[n.ID]; ok {
                                          return fmt.Errorf("network %s already allocated", n.ID)
                                      }
                                  
                                  
                                  Severity: Major
                                  Found in libnetwork/cnmallocator/networkallocator.go - About 35 mins to fix

                                    Method Client.BuildCachePrune has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (cli *Client) BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) {
                                        if err := cli.NewVersionError(ctx, "1.31", "build prune"); err != nil {
                                            return nil, err
                                        }
                                    
                                    
                                    Severity: Major
                                    Found in client/build_prune.go - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language