dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method Controller.reservePools has 58 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *Controller) reservePools() {
    networks, err := c.getNetworks()
    if err != nil {
        log.G(context.TODO()).Warnf("Could not retrieve networks from local store during ipam allocation for existing networks: %v", err)
        return
Severity: Minor
Found in libnetwork/controller.go - About 1 hr to fix

    Method Controller.addServiceBinding has 58 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (c *Controller) addServiceBinding(svcName, svcID, nID, eID, containerName string, vip net.IP, ingressPorts []*PortConfig, serviceAliases, taskAliases []string, ip net.IP, method string) error {
        var addService bool
    
        // Failure to lock the network ID on add can result in racing
        // against network deletion resulting in inconsistent state
    Severity: Minor
    Found in libnetwork/service_common.go - About 1 hr to fix

      Method NetworkDB.gossip has 58 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (nDB *NetworkDB) gossip() {
          networkNodes := make(map[string][]string)
          nDB.RLock()
          thisNodeNetworks := nDB.networks[nDB.config.NodeID]
          for nid := range thisNodeNetworks {
      Severity: Minor
      Found in libnetwork/networkdb/cluster.go - About 1 hr to fix

        Function withCgroups has 58 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func withCgroups(daemon *Daemon, daemonCfg *dconfig.Config, c *container.Container) coci.SpecOpts {
            return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
                var cgroupsPath string
                scopePrefix := "docker"
                parent := "/docker"
        Severity: Minor
        Found in daemon/oci_linux.go - About 1 hr to fix

          Method Reader.TestConcurrent has 58 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (tr Reader) TestConcurrent(t *testing.T) {
              t.Parallel()
              l := tr.Factory(t, logger.Info{
                  ContainerID:   "logconcurrent0",
                  ContainerName: "logconcurrent123",
          Severity: Minor
          Found in daemon/logger/loggertest/logreader.go - About 1 hr to fix

            Method ImageService.ImageHistory has 58 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (i *ImageService) ImageHistory(ctx context.Context, name string, platform *ocispec.Platform) ([]*image.HistoryResponseItem, error) {
                start := time.Now()
                img, err := i.GetImage(ctx, name, backend.GetImageOpts{Platform: platform})
                if err != nil {
                    return nil, err
            Severity: Minor
            Found in daemon/images/image_history.go - About 1 hr to fix

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

                      if named != nil && len(sameRef) > 0 && len(sameRef) != len(all) {
                          var records []imagetypes.DeleteResponse
                          for _, ref := range sameRef {
                              // TODO: Add with target
                              err := i.images.Delete(ctx, ref.Name)
              Severity: Major
              Found in daemon/containerd/image_delete.go and 1 other location - About 1 hr to fix
              daemon/containerd/image_delete.go on lines 131..151

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

              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

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

                      if len(sameRef) != len(all) {
                          var records []imagetypes.DeleteResponse
                          for _, ref := range sameRef {
                              // TODO: Add with target
                              err := i.images.Delete(ctx, ref.Name)
              Severity: Major
              Found in daemon/containerd/image_delete.go and 1 other location - About 1 hr to fix
              daemon/containerd/image_delete.go on lines 100..115

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

              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 (c *Cluster) RemoveConfig(input string) error {
                  return c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                      config, err := getConfig(ctx, state.controlClient, input)
                      if err != nil {
                          return err
              Severity: Major
              Found in daemon/cluster/configs.go and 1 other location - About 1 hr to fix
              daemon/cluster/secrets.go on lines 86..100

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

              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 (c *Cluster) RemoveSecret(input string) error {
                  return c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                      secret, err := getSecret(ctx, state.controlClient, input)
                      if err != nil {
                          return err
              Severity: Major
              Found in daemon/cluster/secrets.go and 1 other location - About 1 hr to fix
              daemon/cluster/configs.go on lines 85..99

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

              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

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

              func getSubnetForIP(ip *net.IPNet, subnets []*ipSubnet) *ipSubnet {
                  for _, s := range subnets {
                      _, snet, err := net.ParseCIDR(s.SubnetIP)
                      if err != nil {
                          return nil
              Severity: Major
              Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go and 1 other location - About 1 hr to fix
              libnetwork/drivers/macvlan/macvlan_joinleave.go on lines 143..161

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

              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

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

              func getSubnetForIP(ip *net.IPNet, subnets []*ipSubnet) *ipSubnet {
                  for _, s := range subnets {
                      _, snet, err := net.ParseCIDR(s.SubnetIP)
                      if err != nil {
                          return nil
              Severity: Major
              Found in libnetwork/drivers/macvlan/macvlan_joinleave.go and 1 other location - About 1 hr to fix
              libnetwork/drivers/ipvlan/ipvlan_joinleave.go on lines 199..217

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

              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 toContainer(hostID int, idMap []IDMap) (int, error) {
                  if idMap == nil {
                      return hostID, nil
                  }
                  for _, m := range idMap {
              Severity: Major
              Found in pkg/idtools/idtools.go and 1 other location - About 1 hr to fix
              pkg/idtools/idtools.go on lines 91..102

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

              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 lookupSubUIDRanges(usr user.User) ([]IDMap, error) {
                  rangeList, err := parseSubuid(strconv.Itoa(usr.Uid))
                  if err != nil {
                      return nil, err
                  }
              Severity: Major
              Found in pkg/idtools/idtools_unix.go and 1 other location - About 1 hr to fix
              pkg/idtools/idtools_unix.go on lines 263..278

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

              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 (n *bridgeNetwork) setupFirewalld(config *networkConfiguration, i *bridgeInterface) error {
                  d := n.driver
                  d.Lock()
                  driverConfig := d.config
                  d.Unlock()
              Severity: Major
              Found in libnetwork/drivers/bridge/setup_firewalld.go and 1 other location - About 1 hr to fix
              libnetwork/drivers/bridge/setup_firewalld.go on lines 27..41

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

              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 (n *bridgeNetwork) setupFirewalld6(config *networkConfiguration, i *bridgeInterface) error {
                  d := n.driver
                  d.Lock()
                  driverConfig := d.config
                  d.Unlock()
              Severity: Major
              Found in libnetwork/drivers/bridge/setup_firewalld.go and 1 other location - About 1 hr to fix
              libnetwork/drivers/bridge/setup_firewalld.go on lines 11..25

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

              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 toHost(contID int, idMap []IDMap) (int, error) {
                  if idMap == nil {
                      return contID, nil
                  }
                  for _, m := range idMap {
              Severity: Major
              Found in pkg/idtools/idtools.go and 1 other location - About 1 hr to fix
              pkg/idtools/idtools.go on lines 75..86

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

              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 lookupSubGIDRanges(usr user.User) ([]IDMap, error) {
                  rangeList, err := parseSubgid(strconv.Itoa(usr.Uid))
                  if err != nil {
                      return nil, err
                  }
              Severity: Major
              Found in pkg/idtools/idtools_unix.go and 1 other location - About 1 hr to fix
              pkg/idtools/idtools_unix.go on lines 246..261

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

              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 GetBroadcastIP(ip net.IP, mask net.IPMask) (net.IP, error) {
                  // Find the effective starting of address and mask
                  is, ms, err := compareIPMask(ip, mask)
                  if err != nil {
                      return nil, fmt.Errorf("cannot compute broadcast ip address because %s", err)
              Severity: Major
              Found in libnetwork/types/types.go and 1 other location - About 1 hr to fix
              libnetwork/types/types.go on lines 289..303

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

              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

              package client // import "github.com/docker/docker/client"
              
              import (
                  "context"
                  "encoding/json"
              Severity: Major
              Found in client/swarm_inspect.go and 2 other locations - About 1 hr to fix
              client/swarm_get_unlock_key.go on lines 1..21
              client/version.go on lines 1..21

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

              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