dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Function buildPortsRelatedCreateEndpointOptions has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func buildPortsRelatedCreateEndpointOptions(c *container.Container, n *libnetwork.Network, sb *libnetwork.Sandbox) ([]libnetwork.EndpointOption, error) {
    // Port-mapping rules belong to the container & applicable only to non-internal networks.
    //
    // TODO(thaJeztah): Look if we can provide a more minimal function for getPortMapInfo, as it does a lot, and we only need the "length".
    if n.Internal() || len(getPortMapInfo(sb)) > 0 {
Severity: Minor
Found in daemon/network.go - About 1 hr to fix

    Function buildIPAMResources has 59 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func buildIPAMResources(nw *libnetwork.Network) networktypes.IPAM {
        var ipamConfig []networktypes.IPAMConfig
    
        ipamDriver, ipamOptions, ipv4Conf, ipv6Conf := nw.IpamConfig()
    
    
    Severity: Minor
    Found in daemon/network.go - About 1 hr to fix

      Function Parse has 59 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func Parse(filePath string, objName string) (*ParsedPkg, error) {
          fs := token.NewFileSet()
          pkg, err := parser.ParseFile(fs, filePath, nil, parser.AllErrors)
          if err != nil {
              return nil, err
      Severity: Minor
      Found in pkg/plugins/pluginrpc-gen/parser.go - About 1 hr to fix

        Method Daemon.containerStop has 59 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (daemon *Daemon) containerStop(ctx context.Context, ctr *container.Container, options containertypes.StopOptions) (retErr error) {
            // Cancelling the request should not cancel the stop.
            ctx = context.WithoutCancel(ctx)
        
            if !ctr.IsRunning() {
        Severity: Minor
        Found in daemon/stop.go - About 1 hr to fix

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

          func (this *PortConfig) String() string {
              if this == nil {
                  return "nil"
              }
              s := strings.Join([]string{`&PortConfig{`,
          Severity: Major
          Found in libnetwork/agent.pb.go and 2 other locations - About 1 hr to fix
          libnetwork/networkdb/networkdb.pb.go on lines 1614..1626
          libnetwork/networkdb/networkdb.pb.go on lines 1627..1639

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

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

          func (this *NetworkEvent) String() string {
              if this == nil {
                  return "nil"
              }
              s := strings.Join([]string{`&NetworkEvent{`,
          Severity: Major
          Found in libnetwork/networkdb/networkdb.pb.go and 2 other locations - About 1 hr to fix
          libnetwork/agent.pb.go on lines 597..609
          libnetwork/networkdb/networkdb.pb.go on lines 1627..1639

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

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

          func (this *NetworkEntry) String() string {
              if this == nil {
                  return "nil"
              }
              s := strings.Join([]string{`&NetworkEntry{`,
          Severity: Major
          Found in libnetwork/networkdb/networkdb.pb.go and 2 other locations - About 1 hr to fix
          libnetwork/agent.pb.go on lines 597..609
          libnetwork/networkdb/networkdb.pb.go on lines 1614..1626

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

          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 Plugin.Set has 14 return statements (exceeds 4 allowed).
          Open

          func (p *Plugin) Set(args []string) error {
              p.mu.Lock()
              defer p.mu.Unlock()
          
              if p.PluginObj.Enabled {
          Severity: Major
          Found in plugin/v2/plugin.go - About 1 hr to fix

            Method driver.Join has 14 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, "libnetwork.drivers.macvlan.Join", trace.WithAttributes(
                    attribute.String("nid", nid),
                    attribute.String("eid", eid),
                    attribute.String("sboxKey", sboxKey)))
            Severity: Major
            Found in libnetwork/drivers/macvlan/macvlan_joinleave.go - About 1 hr to fix

              Method client.createWindows has 14 return statements (exceeds 4 allowed).
              Open

              func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions interface{}) (*container, error) {
                  logger := c.logger.WithField("container", id)
                  configuration := &hcsshim.ContainerConfig{
                      SystemType:              "Container",
                      Name:                    id,
              Severity: Major
              Found in libcontainerd/local/local_windows.go - About 1 hr to fix

                Method ImageService.getPushDescriptor has 14 return statements (exceeds 4 allowed).
                Open

                func (i *ImageService) getPushDescriptor(ctx context.Context, img containerdimages.Image, platform *ocispec.Platform) (ocispec.Descriptor, error) {
                    pm := i.matchRequestedOrDefault(platforms.OnlyStrict, platform)
                
                    anyMissing := false
                
                
                Severity: Major
                Found in daemon/containerd/image_push.go - About 1 hr to fix

                  Method ImageService.resolveAllReferences has 14 return statements (exceeds 4 allowed).
                  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 1 hr to fix

                    Method ImageService.resolveImage has 14 return statements (exceeds 4 allowed).
                    Open

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

                      Method ImageService.ExportImage has 14 return statements (exceeds 4 allowed).
                      Open

                      func (i *ImageService) ExportImage(ctx context.Context, names []string, platform *ocispec.Platform, outStream io.Writer) error {
                          pm := i.matchRequestedOrDefault(platforms.OnlyStrict, platform)
                      
                          opts := []archive.ExportOpt{
                              archive.WithSkipNonDistributableBlobs(),
                      Severity: Major
                      Found in daemon/containerd/image_exporter.go - About 1 hr to fix

                        Method Daemon.openContainerFS has 14 return statements (exceeds 4 allowed).
                        Open

                        func (daemon *Daemon) openContainerFS(ctr *container.Container) (_ *containerFSView, retErr error) {
                            ctx := context.TODO()
                        
                            if err := daemon.Mount(ctr); err != nil {
                                return nil, err
                        Severity: Major
                        Found in daemon/containerfs_linux.go - About 1 hr to fix

                          Function New has 14 return statements (exceeds 4 allowed).
                          Open

                          func New(info logger.Info) (logger.Logger, error) {
                              hostname, err := info.Hostname()
                              if err != nil {
                                  return nil, fmt.Errorf("%s: cannot access hostname to set source field", driverName)
                              }
                          Severity: Major
                          Found in daemon/logger/splunk/splunk.go - About 1 hr to fix

                            Method Daemon.ContainerRename has 14 return statements (exceeds 4 allowed).
                            Open

                            func (daemon *Daemon) ContainerRename(oldName, newName string) (retErr error) {
                                if oldName == "" || newName == "" {
                                    return errdefs.InvalidParameter(errors.New("Neither old nor new names may be empty"))
                                }
                            
                            
                            Severity: Major
                            Found in daemon/rename.go - About 1 hr to fix

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

                              func (l *sLM) DeleteResource(ctx context.Context, lease leases.Lease, resource leases.Resource) error {
                                  if err := l.manager.DeleteResource(ctx, lease, resource); err != nil {
                                      return err
                                  }
                                  if resource.Type == "snapshots/default" {
                              Severity: Major
                              Found in builder/builder-next/adapters/snapshot/leasemanager.go and 1 other location - About 1 hr to fix
                              builder/builder-next/adapters/snapshot/leasemanager.go on lines 53..63

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

                              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

                              func (l *sLM) AddResource(ctx context.Context, lease leases.Lease, resource leases.Resource) error {
                                  if err := l.manager.AddResource(ctx, lease, resource); err != nil {
                                      return err
                                  }
                                  if resource.Type == "snapshots/default" {
                              Severity: Major
                              Found in builder/builder-next/adapters/snapshot/leasemanager.go and 1 other location - About 1 hr to fix
                              builder/builder-next/adapters/snapshot/leasemanager.go on lines 65..75

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

                              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 pushDescriptor.layerAlreadyExists has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (pd *pushDescriptor) layerAlreadyExists(
                                  ctx context.Context,
                                  progressOutput progress.Output,
                                  diffID layer.DiffID,
                                  checkOtherRepositories bool,
                              Severity: Minor
                              Found in distribution/push_v2.go - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language