dotcloud/docker

View on GitHub

Showing 1,885 of 1,885 total issues

Method PluginSpec.Unmarshal has 37 return statements (exceeds 4 allowed).
Open

func (m *PluginSpec) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in api/types/swarm/runtime/plugin.pb.go - About 3 hrs to fix

    Method ImageService.createDiff has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
    Open

    func (i *ImageService) createDiff(ctx context.Context, name string, sn snapshots.Snapshotter, cs content.Store, comparer diff.Comparer) (*ocispec.Descriptor, digest.Digest, error) {
        info, err := sn.Stat(ctx, name)
        if err != nil {
            return nil, "", err
        }
    Severity: Minor
    Found in daemon/containerd/image_commit.go - About 3 hrs 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 layerDescriptor.Download has 106 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (ld *layerDescriptor) Download(ctx context.Context, progressOutput progress.Output) (io.ReadCloser, int64, error) {
        log.G(ctx).Debugf("pulling blob %q", ld.digest)
    
        var (
            err    error
    Severity: Major
    Found in distribution/pull_v2.go - About 3 hrs to fix

      Method imageExporterInstance.Export has 106 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (e *imageExporterInstance) Export(ctx context.Context, inp *exporter.Source, inlineCache exptypes.InlineCache, sessionID string) (map[string]string, exporter.DescriptorReference, error) {
          if len(inp.Refs) > 1 {
              return nil, nil, fmt.Errorf("exporting multiple references to image store is currently unsupported")
          }
      
      
      Severity: Major
      Found in builder/builder-next/exporter/mobyexporter/export.go - About 3 hrs to fix

        File sandbox.go has 551 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package libnetwork
        
        import (
            "context"
            "encoding/json"
        Severity: Minor
        Found in libnetwork/sandbox.go - About 3 hrs to fix

          Method Daemon.createSpec has 105 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) createSpec(ctx context.Context, daemonCfg *configStore, c *container.Container, mounts []container.Mount) (*specs.Spec, error) {
              img, err := daemon.imageService.GetImage(ctx, string(c.ImageID), backend.GetImageOpts{})
              if err != nil {
                  return nil, err
              }
          Severity: Major
          Found in daemon/oci_windows.go - About 3 hrs to fix

            Method driver.Join has 104 lines of code (exceeds 50 allowed). Consider refactoring.
            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, "libnetwork.drivers.ipvlan.Join", trace.WithAttributes(
                    attribute.String("nid", nid),
                    attribute.String("eid", eid),
                    attribute.String("sboxKey", sboxKey)))
            Severity: Major
            Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go - About 3 hrs to fix

              Method driver.CreateNetwork has 103 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
                  var (
                      networkName   string
                      interfaceName string
                      staleNetworks []string
              Severity: Major
              Found in libnetwork/drivers/windows/overlay/ov_network_windows.go - About 3 hrs to fix

                Method ImageService.resolveAllReferences has 103 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (i *ImageService) resolveAllReferences(ctx context.Context, refOrID string) (*containerdimages.Image, []containerdimages.Image, error) {
                    parsed, err := reference.ParseAnyReference(refOrID)
                    if err != nil {
                        return nil, nil, errdefs.InvalidParameter(err)
                    }
                Severity: Major
                Found in daemon/containerd/image.go - About 3 hrs to fix

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

                          case 1:
                              if wireType != 2 {
                                  return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType)
                              }
                              var msglen int
                  Severity: Major
                  Found in libnetwork/networkdb/networkdb.pb.go and 3 other locations - About 3 hrs to fix
                  api/types/swarm/runtime/plugin.pb.go on lines 472..505
                  libnetwork/agent.pb.go on lines 807..840
                  libnetwork/networkdb/networkdb.pb.go on lines 2297..2330

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

                  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 4 locations. Consider refactoring.
                  Open

                          case 2:
                              if wireType != 2 {
                                  return fmt.Errorf("proto: wrong wireType = %d for field Networks", wireType)
                              }
                              var msglen int
                  Severity: Major
                  Found in libnetwork/networkdb/networkdb.pb.go and 3 other locations - About 3 hrs to fix
                  api/types/swarm/runtime/plugin.pb.go on lines 472..505
                  libnetwork/agent.pb.go on lines 807..840
                  libnetwork/networkdb/networkdb.pb.go on lines 2869..2902

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

                  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 4 locations. Consider refactoring.
                  Open

                          case 3:
                              if wireType != 2 {
                                  return fmt.Errorf("proto: wrong wireType = %d for field Privileges", wireType)
                              }
                              var msglen int
                  Severity: Major
                  Found in api/types/swarm/runtime/plugin.pb.go and 3 other locations - About 3 hrs to fix
                  libnetwork/agent.pb.go on lines 807..840
                  libnetwork/networkdb/networkdb.pb.go on lines 2297..2330
                  libnetwork/networkdb/networkdb.pb.go on lines 2869..2902

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

                  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 4 locations. Consider refactoring.
                  Open

                          case 6:
                              if wireType != 2 {
                                  return fmt.Errorf("proto: wrong wireType = %d for field IngressPorts", wireType)
                              }
                              var msglen int
                  Severity: Major
                  Found in libnetwork/agent.pb.go and 3 other locations - About 3 hrs to fix
                  api/types/swarm/runtime/plugin.pb.go on lines 472..505
                  libnetwork/networkdb/networkdb.pb.go on lines 2297..2330
                  libnetwork/networkdb/networkdb.pb.go on lines 2869..2902

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

                  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

                  Method Endpoint.UnmarshalJSON has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (ep *Endpoint) UnmarshalJSON(b []byte) (err error) {
                      ep.mu.Lock()
                      defer ep.mu.Unlock()
                  
                      var epMap map[string]interface{}
                  Severity: Minor
                  Found in libnetwork/endpoint.go - About 3 hrs 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 ImageService.pushRef has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (i *ImageService) pushRef(ctx context.Context, targetRef reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, out progress.Output) (retErr error) {
                      leasedCtx, release, err := i.client.WithLease(ctx)
                      if err != nil {
                          return err
                      }
                  Severity: Minor
                  Found in daemon/containerd/image_push.go - About 3 hrs 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 buildCreateEndpointOptions has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func buildCreateEndpointOptions(c *container.Container, n *libnetwork.Network, epConfig *network.EndpointSettings, sb *libnetwork.Sandbox, daemonDNS []string) ([]libnetwork.EndpointOption, error) {
                      var createOptions []libnetwork.EndpointOption
                      var genericOptions = make(options.Generic)
                  
                      nwName := n.Name()
                  Severity: Minor
                  Found in daemon/network.go - About 3 hrs 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 Daemon.connectToNetwork has a Cognitive Complexity of 37 (exceeds 20 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: Minor
                  Found in daemon/container_operations.go - About 3 hrs 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

                  File encryption.go has 545 lines of code (exceeds 500 allowed). Consider refactoring.
                  Open

                  //go:build linux
                  
                  package overlay
                  
                  import (
                  Severity: Minor
                  Found in libnetwork/drivers/overlay/encryption.go - About 3 hrs to fix

                    File image_list.go has 545 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    package containerd
                    
                    import (
                        "context"
                        "encoding/json"
                    Severity: Minor
                    Found in daemon/containerd/image_list.go - About 3 hrs to fix

                      Method ImageService.pushRef has 102 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (i *ImageService) pushRef(ctx context.Context, targetRef reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, out progress.Output) (retErr error) {
                          leasedCtx, release, err := i.client.WithLease(ctx)
                          if err != nil {
                              return err
                          }
                      Severity: Major
                      Found in daemon/containerd/image_push.go - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language