dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method Cluster.Init has 96 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *Cluster) Init(req types.InitRequest) (string, error) {
    c.controlMutex.Lock()
    defer c.controlMutex.Unlock()
    if c.nr != nil {
        if req.ForceNewCluster {
Severity: Major
Found in daemon/cluster/swarm.go - About 2 hrs to fix

    Method Daemon.handleContainerExit has 96 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontainerdtypes.EventInfo) error {
        var exitStatus container.ExitStatus
        c.Lock()
    
        cfg := daemon.config()
    Severity: Major
    Found in daemon/monitor.go - About 2 hrs to fix

      Method Daemon.connectToNetwork has 96 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (daemon *Daemon) connectToNetwork(ctx context.Context, cfg *config.Config, ctr *container.Container, idOrName string, endpointConfig *network.EndpointSettings, updateSettings bool) (retErr error) {
          containerName := strings.TrimPrefix(ctr.Name, "/")
          ctx, span := otel.Tracer("").Start(ctx, "daemon.connectToNetwork", trace.WithAttributes(
              attribute.String("container.ID", ctr.ID),
              attribute.String("container.name", containerName),
      Severity: Major
      Found in daemon/container_operations.go - About 2 hrs to fix

        driver has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type driver struct {
            config            configuration
            natChain          *iptables.ChainInfo
            filterChain       *iptables.ChainInfo
            isolationChain1   *iptables.ChainInfo
        Severity: Minor
        Found in libnetwork/drivers/bridge/bridge_linux.go - About 2 hrs to fix

          cnmNetworkAllocator has 25 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type cnmNetworkAllocator struct {
              // The plugin getter instance used to get network and IPAM driver plugins.
              pg plugingetter.PluginGetter
          
              // The driver registry for all internal and external IPAM drivers.
          Severity: Minor
          Found in libnetwork/cnmallocator/networkallocator.go - About 2 hrs to fix

            containerConfig has 25 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type containerConfig struct {
                task                *api.Task
                networksAttachments map[string]*api.NetworkAttachment
            }
            Severity: Minor
            Found in daemon/cluster/executor/container/container.go - About 2 hrs to fix

              Method task.Exec has 95 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (t *task) Exec(ctx context.Context, processID string, spec *specs.Process, withStdin bool, attachStdio libcontainerdtypes.StdioCallback) (_ libcontainerdtypes.Process, retErr error) {
                  hcsContainer, err := t.getHCSContainer()
                  if err != nil {
                      return nil, err
                  }
              Severity: Major
              Found in libcontainerd/local/local_windows.go - About 2 hrs to fix

                Method client.newStdioPipes has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (c *client) newStdioPipes(fifos *cio.FIFOSet) (_ *stdioPipes, err error) {
                    p := &stdioPipes{}
                    if fifos.Stdin != "" {
                        c.logger.WithField("stdin", fifos.Stdin).Debug("listen")
                        l, err := winio.ListenPipe(fifos.Stdin, nil)
                Severity: Major
                Found in libcontainerd/remote/client_io_windows.go - About 2 hrs to fix

                  Method Daemon.foldFilter has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (daemon *Daemon) foldFilter(ctx context.Context, view *container.View, config *containertypes.ListOptions) (*listContext, error) {
                      psFilters := config.Filters
                  
                      var filtExited []int
                  
                  
                  Severity: Major
                  Found in daemon/list.go - About 2 hrs to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                if os.Getenv("DOCKER_SERVICE_PREFER_OFFLINE_IMAGE") != "1" && queryRegistry {
                                    digestImage, err := c.imageWithDigestString(ctx, ctnr.Image, authConfig)
                                    if err != nil {
                                        log.G(ctx).Warnf("unable to pin image %s to digest: %s", ctnr.Image, err.Error())
                                        // warning in the client response should be concise
                    Severity: Major
                    Found in daemon/cluster/services.go and 1 other location - About 2 hrs to fix
                    daemon/cluster/services.go on lines 363..386

                    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 238.

                    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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                if os.Getenv("DOCKER_SERVICE_PREFER_OFFLINE_IMAGE") != "1" && queryRegistry {
                                    digestImage, err := c.imageWithDigestString(ctx, newCtnr.Image, authConfig)
                                    if err != nil {
                                        log.G(ctx).Warnf("unable to pin image %s to digest: %s", newCtnr.Image, err.Error())
                                        // warning in the client response should be concise
                    Severity: Major
                    Found in daemon/cluster/services.go and 1 other location - About 2 hrs to fix
                    daemon/cluster/services.go on lines 247..270

                    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 238.

                    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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    package client // import "github.com/docker/docker/client"
                    
                    import (
                        "context"
                        "encoding/json"
                    Severity: Major
                    Found in client/task_list.go and 1 other location - About 2 hrs to fix
                    client/node_list.go on lines 1..35

                    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 238.

                    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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    package client // import "github.com/docker/docker/client"
                    
                    import (
                        "context"
                        "encoding/json"
                    Severity: Major
                    Found in client/node_list.go and 1 other location - About 2 hrs to fix
                    client/task_list.go on lines 1..35

                    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 238.

                    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

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                            case 2:
                                if wireType != 2 {
                                    return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
                                }
                                var byteLen int
                    Severity: Major
                    Found in libnetwork/networkdb/networkdb.pb.go and 4 other locations - About 2 hrs to fix
                    api/types/plugins/logdriver/entry.pb.go on lines 440..473
                    libnetwork/networkdb/networkdb.pb.go on lines 2579..2612
                    libnetwork/networkdb/networkdb.pb.go on lines 2785..2818
                    libnetwork/networkdb/networkdb.pb.go on lines 2953..2986

                    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 237.

                    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

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                            case 7:
                                if wireType != 2 {
                                    return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
                                }
                                var byteLen int
                    Severity: Major
                    Found in libnetwork/networkdb/networkdb.pb.go and 4 other locations - About 2 hrs to fix
                    api/types/plugins/logdriver/entry.pb.go on lines 440..473
                    libnetwork/networkdb/networkdb.pb.go on lines 1769..1802
                    libnetwork/networkdb/networkdb.pb.go on lines 2785..2818
                    libnetwork/networkdb/networkdb.pb.go on lines 2953..2986

                    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 237.

                    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

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                            case 3:
                                if wireType != 2 {
                                    return fmt.Errorf("proto: wrong wireType = %d for field Line", wireType)
                                }
                                var byteLen int
                    Severity: Major
                    Found in api/types/plugins/logdriver/entry.pb.go and 4 other locations - About 2 hrs to fix
                    libnetwork/networkdb/networkdb.pb.go on lines 1769..1802
                    libnetwork/networkdb/networkdb.pb.go on lines 2579..2612
                    libnetwork/networkdb/networkdb.pb.go on lines 2785..2818
                    libnetwork/networkdb/networkdb.pb.go on lines 2953..2986

                    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 237.

                    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

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                            case 1:
                                if wireType != 2 {
                                    return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType)
                                }
                                var byteLen int
                    Severity: Major
                    Found in libnetwork/networkdb/networkdb.pb.go and 4 other locations - About 2 hrs to fix
                    api/types/plugins/logdriver/entry.pb.go on lines 440..473
                    libnetwork/networkdb/networkdb.pb.go on lines 1769..1802
                    libnetwork/networkdb/networkdb.pb.go on lines 2579..2612
                    libnetwork/networkdb/networkdb.pb.go on lines 2785..2818

                    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 237.

                    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

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                            case 5:
                                if wireType != 2 {
                                    return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType)
                                }
                                var byteLen int
                    Severity: Major
                    Found in libnetwork/networkdb/networkdb.pb.go and 4 other locations - About 2 hrs to fix
                    api/types/plugins/logdriver/entry.pb.go on lines 440..473
                    libnetwork/networkdb/networkdb.pb.go on lines 1769..1802
                    libnetwork/networkdb/networkdb.pb.go on lines 2579..2612
                    libnetwork/networkdb/networkdb.pb.go on lines 2953..2986

                    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 237.

                    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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if opt, ok := ep.generic[netlabel.PortMap]; ok {
                                pblist := []types.PortBinding{}
                    
                                for i := 0; i < len(opt.([]interface{})); i++ {
                                    pb := types.PortBinding{}
                    Severity: Major
                    Found in libnetwork/endpoint.go and 1 other location - About 2 hrs to fix
                    libnetwork/endpoint.go on lines 184..204

                    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 237.

                    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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if opt, ok := ep.generic[netlabel.ExposedPorts]; ok {
                                tplist := []types.TransportPort{}
                    
                                for i := 0; i < len(opt.([]interface{})); i++ {
                                    tp := types.TransportPort{}
                    Severity: Major
                    Found in libnetwork/endpoint.go and 1 other location - About 2 hrs to fix
                    libnetwork/endpoint.go on lines 162..182

                    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 237.

                    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