dotcloud/docker

View on GitHub

Showing 1,885 of 1,885 total issues

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

    func (e *v1Endpoint) ping() (v1PingResult, error) {
        if e.String() == IndexServer {
            // Skip the check, we know this one is valid
            // (and we never want to fallback to http in case of error)
            return v1PingResult{}, nil
    Severity: Major
    Found in registry/search_endpoint_v1.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 Client.NetworksPrune has 5 return statements (exceeds 4 allowed).
        Open

        func (cli *Client) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (network.PruneReport, error) {
            var report network.PruneReport
        
            if err := cli.NewVersionError(ctx, "1.25", "network prune"); err != nil {
                return report, err
        Severity: Major
        Found in client/network_prune.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 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

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

                func newDaemonCommand() (*cobra.Command, error) {
                    // FIXME(thaJeztah): config.New also looks up default binary-path, but this code is also executed when running "--version".
                    cfg, err := config.New()
                    if err != nil {
                        return nil, err
                Severity: Major
                Found in cmd/dockerd/docker.go - About 35 mins to fix

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

                  func (config *serviceConfig) loadInsecureRegistries(registries []string) error {
                      // Localhost is by default considered as an insecure registry. This is a
                      // stop-gap for people who are running a private registry on localhost.
                      registries = append(registries, "127.0.0.0/8")
                  
                  
                  Severity: Minor
                  Found in registry/config.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.ContainersPrune has 5 return statements (exceeds 4 allowed).
                  Open

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

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

                    func ValidateMirror(val string) (string, error) {
                        uri, err := url.Parse(val)
                        if err != nil {
                            return "", invalidParamWrapf(err, "invalid mirror: %q is not a valid URI", val)
                        }
                    Severity: Major
                    Found in registry/config.go - About 35 mins to fix

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

                      func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error {
                          ctx, span := otel.Tracer("").Start(ctx, fmt.Sprintf("libnetwork.drivers.windows_%s.Join", d.name), trace.WithAttributes(
                              attribute.String("nid", nid),
                              attribute.String("eid", eid),
                              attribute.String("sboxKey", sboxKey)))
                      Severity: Major
                      Found in libnetwork/drivers/windows/windows.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 authTransport.RoundTrip has 5 return statements (exceeds 4 allowed).
                          Open

                          func (tr *authTransport) RoundTrip(orig *http.Request) (*http.Response, error) {
                              // Authorization should not be set on 302 redirect for untrusted locations.
                              // This logic mirrors the behavior in addRequiredHeadersToRedirectedRequests.
                              // As the authorization logic is currently implemented in RoundTrip,
                              // a 302 redirect is detected by looking at the Referrer header as go http package adds said header.
                          Severity: Major
                          Found in registry/search_session.go - About 35 mins to fix

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

                            func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error) {
                                var response container.CreateResponse
                            
                                // Make sure we negotiated (if the client is configured to do so),
                                // as code below contains API-version specific handling of options.
                            Severity: Minor
                            Found in client/container_create.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 VolumeStore.restore has 5 return statements (exceeds 4 allowed).
                            Open

                            func (s *VolumeStore) restore() {
                                var ls []volumeMetadata
                                s.db.View(func(tx *bolt.Tx) error {
                                    ls = listMeta(tx)
                                    return nil
                            Severity: Major
                            Found in volume/service/restore.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

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

                                  func (na *cnmNetworkAllocator) AllocateService(s *api.Service) (err error) {
                                      defer func() {
                                          if err != nil {
                                              na.DeallocateService(s)
                                          }
                                  Severity: Major
                                  Found in libnetwork/cnmallocator/networkallocator.go - About 35 mins to fix

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

                                    func (cli *Client) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (image.PruneReport, error) {
                                        var report image.PruneReport
                                    
                                        if err := cli.NewVersionError(ctx, "1.25", "image prune"); err != nil {
                                            return report, err
                                    Severity: Major
                                    Found in client/image_prune.go - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language