dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method Cluster.GetServices has 6 return statements (exceeds 4 allowed).
Open

func (c *Cluster) GetServices(options types.ServiceListOptions) ([]swarm.Service, error) {
    c.mu.RLock()
    defer c.mu.RUnlock()

    state := c.currentNodeState()
Severity: Major
Found in daemon/cluster/services.go - About 40 mins to fix

    Method sharedTempFileConverter.convert has 6 return statements (exceeds 4 allowed).
    Open

    func (c *sharedTempFileConverter) convert(f *os.File) (converted *os.File, size int64, err error) {
        dst, err := os.CreateTemp(c.TempDir, "dockerdtemp.*")
        if err != nil {
            return nil, 0, err
        }
    Severity: Major
    Found in daemon/logger/loggerutils/sharedtemp.go - About 40 mins to fix

      Method reader.readJournal has 6 return statements (exceeds 4 allowed).
      Open

      func (r *reader) readJournal(ctx context.Context) error {
          caughtUp := r.s.ordinal.Load()
          if more, err := r.drainJournal(ctx); err != nil || !more {
              return err
          }
      Severity: Major
      Found in daemon/logger/journald/read.go - About 40 mins to fix

        Method Daemon.getExecConfig has 6 return statements (exceeds 4 allowed).
        Open

        func (daemon *Daemon) getExecConfig(name string) (*container.ExecConfig, error) {
            ec := daemon.execCommands.Get(name)
            if ec == nil {
                return nil, errExecNotFound(name)
            }
        Severity: Major
        Found in daemon/exec.go - About 40 mins to fix

          Method Daemon.ContainerExport has 6 return statements (exceeds 4 allowed).
          Open

          func (daemon *Daemon) ContainerExport(ctx context.Context, name string, out io.Writer) error {
              ctr, err := daemon.GetContainer(name)
              if err != nil {
                  return err
              }
          Severity: Major
          Found in daemon/export.go - About 40 mins to fix

            Function newAWSLogsClient has 6 return statements (exceeds 4 allowed).
            Open

            func newAWSLogsClient(info logger.Info, configOpts ...func(*config.LoadOptions) error) (*cloudwatchlogs.Client, error) {
                ctx := context.TODO()
                var region, endpoint *string
                if os.Getenv(regionEnvKey) != "" {
                    region = aws.String(os.Getenv(regionEnvKey))
            Severity: Major
            Found in daemon/logger/awslogs/cloudwatchlogs.go - About 40 mins to fix

              Method Daemon.GetContainer has 6 return statements (exceeds 4 allowed).
              Open

              func (daemon *Daemon) GetContainer(prefixOrName string) (*container.Container, error) {
                  if len(prefixOrName) == 0 {
                      return nil, errors.WithStack(invalidIdentifier(prefixOrName))
                  }
              
              
              Severity: Major
              Found in daemon/container.go - About 40 mins to fix

                Method Daemon.getInspectData has 6 return statements (exceeds 4 allowed).
                Open

                func (daemon *Daemon) getInspectData(daemonCfg *config.Config, container *container.Container) (*containertypes.ContainerJSONBase, error) {
                    // make a copy to play with
                    hostConfig := *container.HostConfig
                
                    children := daemon.children(container)
                Severity: Major
                Found in daemon/inspect.go - About 40 mins to fix

                  Function FilterNetworks has 6 return statements (exceeds 4 allowed).
                  Open

                  func FilterNetworks(nws []network.Inspect, filter filters.Args) ([]network.Inspect, error) {
                      // if filter is empty, return original network list
                      if filter.Len() == 0 {
                          return nws, nil
                      }
                  Severity: Major
                  Found in daemon/network/filter.go - About 40 mins to fix

                    Function getEndpointPortMapInfo has 6 return statements (exceeds 4 allowed).
                    Open

                    func getEndpointPortMapInfo(ep *libnetwork.Endpoint) (nat.PortMap, error) {
                        pm := nat.PortMap{}
                        driverInfo, err := ep.DriverInfo()
                        if err != nil {
                            return pm, err
                    Severity: Major
                    Found in daemon/network.go - About 40 mins to fix

                      Function buildCreateEndpointOptions has 6 return statements (exceeds 4 allowed).
                      Open

                      func buildCreateEndpointOptions(c *container.Container, n *libnetwork.Network, epConfig *network.EndpointSettings, sb *libnetwork.Sandbox, daemonDNS []string) ([]libnetwork.EndpointOption, error) {
                          var createOptions []libnetwork.EndpointOption
                          genericOptions := make(options.Generic)
                      
                          nwName := n.Name()
                      Severity: Major
                      Found in daemon/network.go - About 40 mins to fix

                        Method Daemon.ContainersPrune has 6 return statements (exceeds 4 allowed).
                        Open

                        func (daemon *Daemon) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (*container.PruneReport, error) {
                            if !daemon.pruneRunning.CompareAndSwap(false, true) {
                                return nil, errPruneRunning
                            }
                            defer daemon.pruneRunning.Store(false)
                        Severity: Major
                        Found in daemon/prune.go - About 40 mins to fix

                          Method ImageService.imageDeleteHelper has 6 return statements (exceeds 4 allowed).
                          Open

                          func (i *ImageService) imageDeleteHelper(imgID image.ID, records *[]imagetypes.DeleteResponse, force, prune, quiet bool) error {
                              // First, determine if this image has any conflicts. Ignore soft conflicts
                              // if force is true.
                              c := conflictHard
                              if !force {
                          Severity: Major
                          Found in daemon/images/image_delete.go - About 40 mins to fix

                            Method ImageService.ImagesPrune has 6 return statements (exceeds 4 allowed).
                            Open

                            func (i *ImageService) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*imagetypes.PruneReport, error) {
                                if !i.pruneRunning.CompareAndSwap(false, true) {
                                    return nil, errPruneRunning
                                }
                                defer i.pruneRunning.Store(false)
                            Severity: Major
                            Found in daemon/images/image_prune.go - About 40 mins to fix

                              Method Daemon.Containers has 6 return statements (exceeds 4 allowed).
                              Open

                              func (daemon *Daemon) Containers(ctx context.Context, config *containertypes.ListOptions) ([]*containertypes.Summary, error) {
                                  if err := config.Filters.Validate(acceptedPsFilterTags); err != nil {
                                      return nil, err
                                  }
                              
                              
                              Severity: Major
                              Found in daemon/list.go - About 40 mins to fix

                                Method Daemon.ContainerAttach has 6 return statements (exceeds 4 allowed).
                                Open

                                func (daemon *Daemon) ContainerAttach(prefixOrName string, req *backend.ContainerAttachConfig) error {
                                    keys := []byte{}
                                    var err error
                                    if req.DetachKeys != "" {
                                        keys, err = term.ToBytes(req.DetachKeys)
                                Severity: Major
                                Found in daemon/attach.go - About 40 mins to fix

                                  Method Daemon.initializeNetworking has 6 return statements (exceeds 4 allowed).
                                  Open

                                  func (daemon *Daemon) initializeNetworking(ctx context.Context, cfg *config.Config, ctr *container.Container) error {
                                      if ctr.HostConfig.NetworkMode.IsContainer() {
                                          // we need to get the hosts files from the container to join
                                          nc, err := daemon.getNetworkedContainer(ctr.ID, ctr.HostConfig.NetworkMode.ConnectedContainer())
                                          if err != nil {
                                  Severity: Major
                                  Found in daemon/container_operations.go - About 40 mins to fix

                                    Function doUnpackLayer has 6 return statements (exceeds 4 allowed).
                                    Open

                                    func doUnpackLayer(root string, layer io.Reader, options *archive.TarOptions) (int64, error) {
                                        var result int64
                                        optionsR, optionsW, err := os.Pipe()
                                        if err != nil {
                                            return 0, err
                                    Severity: Major
                                    Found in pkg/chrootarchive/archive_unix_nolinux.go - About 40 mins to fix

                                      Function FrozenImagesLinux has 6 return statements (exceeds 4 allowed).
                                      Open

                                      func FrozenImagesLinux(ctx context.Context, client client.APIClient, images ...string) error {
                                          ctx, span := otel.Tracer("").Start(ctx, "LoadFrozenImages")
                                          defer span.End()
                                      
                                          var loadImages []struct{ srcName, destName string }
                                      Severity: Major
                                      Found in testutil/fixtures/load/frozen.go - About 40 mins to fix

                                        Identical blocks of code found in 4 locations. Consider refactoring.
                                        Open

                                        func (e ExperimentalMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                                            return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                                                w.Header().Set("Docker-Experimental", e.experimental)
                                                return handler(ctx, w, r, vars)
                                            }
                                        Severity: Major
                                        Found in api/server/middleware/experimental.go and 3 other locations - About 40 mins to fix
                                        api/server/middleware/debug.go on lines 17..55
                                        api/server/middleware/version.go on lines 67..86
                                        pkg/authorization/middleware.go on lines 55..110

                                        Duplicated Code

                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                        Tuning

                                        This issue has a mass of 110.

                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                        Refactorings

                                        Further Reading

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language