dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method Cluster.GetServices has 90 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

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

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

    func (i *ImageService) ImageHistory(ctx context.Context, name string, platform *ocispec.Platform) ([]*imagetype.HistoryResponseItem, error) {
        start := time.Now()
        img, err := i.resolveImage(ctx, name)
        if err != nil {
            return nil, err
    Severity: Major
    Found in daemon/containerd/image_history.go - About 2 hrs to fix

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

      func (sr *swarmRouter) getTasks(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
          if err := httputils.ParseForm(r); err != nil {
              return err
          }
          filter, err := filters.FromJSON(r.Form.Get("filters"))
      Severity: Major
      Found in api/server/router/swarm/cluster_routes.go and 1 other location - About 2 hrs to fix
      api/server/router/swarm/cluster_routes.go on lines 316..332

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

      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 (sr *swarmRouter) getNodes(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
          if err := httputils.ParseForm(r); err != nil {
              return err
          }
          filter, err := filters.FromJSON(r.Form.Get("filters"))
      Severity: Major
      Found in api/server/router/swarm/cluster_routes.go and 1 other location - About 2 hrs to fix
      api/server/router/swarm/cluster_routes.go on lines 387..403

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

      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

      Function volumeName has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
      Open

      func volumeName(path string) (v string) {
          if len(path) < 2 {
              return ""
          }
          // with drive letter
      Severity: Minor
      Found in daemon/logger/loggerutils/file_windows.go - About 2 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 LayerDownloadManager.Download has 89 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS image.RootFS, layers []DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) {
          var (
              topLayer       layer.Layer
              topDownload    *downloadTransfer
              watcher        *watcher
      Severity: Major
      Found in distribution/xfer/download.go - About 2 hrs to fix

        Method driver.Join has 89 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.overlay.Join", trace.WithAttributes(
                attribute.String("nid", nid),
                attribute.String("eid", eid),
                attribute.String("sboxKey", sboxKey)))
        Severity: Major
        Found in libnetwork/drivers/overlay/joinleave.go - About 2 hrs to fix

          Method client.processEventStream has 89 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (c *client) processEventStream(ctx context.Context, ns string) {
              // Create a new context specifically for this subscription.
              // The context must be cancelled to cancel the subscription.
              // In cases where we have to restart event stream processing,
              //   we'll need the original context b/c this one will be cancelled
          Severity: Major
          Found in libcontainerd/remote/client.go - About 2 hrs to fix

            Method ImageService.createDiff has 89 lines of code (exceeds 50 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: Major
            Found in daemon/containerd/image_commit.go - About 2 hrs to fix

              Method walker.walk has 89 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (w *walker) walk(path string, i1, i2 os.FileInfo) (err error) {
                  // Register these nodes with the return trees, unless we're still at the
                  // (already-created) roots:
                  if path != "/" {
                      if err := walkchunk(path, i1, w.dir1, w.root1); err != nil {
              Severity: Major
              Found in pkg/archive/changes_linux.go - About 2 hrs to fix

                Function verifyPlatformContainerResources has 88 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func verifyPlatformContainerResources(resources *containertypes.Resources, isHyperv bool) (warnings []string, err error) {
                    fixMemorySwappiness(resources)
                    if !isHyperv {
                        // The processor resource controls are mutually exclusive on
                        // Windows Server Containers, the order of precedence is
                Severity: Major
                Found in daemon/daemon_windows.go - About 2 hrs to fix

                  Method Daemon.statsV2 has 88 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (daemon *Daemon) statsV2(s *containertypes.StatsResponse, stats *statsV2.Metrics) (*containertypes.StatsResponse, error) {
                      if stats.Io != nil {
                          var isbr []containertypes.BlkioStatEntry
                          for _, re := range stats.Io.Usage {
                              isbr = append(isbr,
                  Severity: Major
                  Found in daemon/stats_unix.go - About 2 hrs to fix

                    Method ImageService.manifestMatchesPlatform has 88 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.Image, platform ocispec.Platform) (bool, error) {
                        ls, err := i.leases.ListResources(ctx, leases.Lease{ID: imageKey(img.ID().String())})
                        if err != nil {
                            if cerrdefs.IsNotFound(err) {
                                return false, nil
                    Severity: Major
                    Found in daemon/images/image.go - About 2 hrs to fix

                      Function merge has 88 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func merge(userConf, imageConf *containertypes.Config) error {
                          if userConf.User == "" {
                              userConf.User = imageConf.User
                          }
                          if len(userConf.ExposedPorts) == 0 {
                      Severity: Major
                      Found in daemon/commit.go - About 2 hrs to fix

                        layerStore has 23 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type layerStore struct {
                            store  *fileMetadataStore
                            driver graphdriver.Driver
                        
                            layerMap map[ChainID]*roLayer
                        Severity: Minor
                        Found in layer/layer_store.go - About 2 hrs to fix

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

                          func getPluginClient(p plugingetter.CompatPlugin) (*plugins.Client, error) {
                              if v1, ok := p.(plugingetter.PluginWithV1Client); ok {
                                  return v1.Client(), nil
                              }
                          
                          
                          Severity: Major
                          Found in libnetwork/drivers/remote/driver.go and 1 other location - About 2 hrs to fix
                          libnetwork/ipams/remote/remote.go on lines 68..88

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

                          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 getPluginClient(p plugingetter.CompatPlugin) (*plugins.Client, error) {
                              if v1, ok := p.(plugingetter.PluginWithV1Client); ok {
                                  return v1.Client(), nil
                              }
                          
                          
                          Severity: Major
                          Found in libnetwork/ipams/remote/remote.go and 1 other location - About 2 hrs to fix
                          libnetwork/drivers/remote/driver.go on lines 69..89

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

                          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 Env", wireType)
                                      }
                                      var stringLen uint64
                          Severity: Major
                          Found in api/types/swarm/runtime/plugin.pb.go and 4 other locations - About 2 hrs to fix
                          api/types/swarm/runtime/plugin.pb.go on lines 672..703
                          libnetwork/agent.pb.go on lines 841..872
                          libnetwork/agent.pb.go on lines 873..904
                          libnetwork/networkdb/networkdb.pb.go on lines 2753..2784

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

                          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 4:
                                      if wireType != 2 {
                                          return fmt.Errorf("proto: wrong wireType = %d for field Networks", wireType)
                                      }
                                      var stringLen uint64
                          Severity: Major
                          Found in libnetwork/networkdb/networkdb.pb.go and 4 other locations - About 2 hrs to fix
                          api/types/swarm/runtime/plugin.pb.go on lines 526..557
                          api/types/swarm/runtime/plugin.pb.go on lines 672..703
                          libnetwork/agent.pb.go on lines 841..872
                          libnetwork/agent.pb.go on lines 873..904

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

                          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 Aliases", wireType)
                                      }
                                      var stringLen uint64
                          Severity: Major
                          Found in libnetwork/agent.pb.go and 4 other locations - About 2 hrs to fix
                          api/types/swarm/runtime/plugin.pb.go on lines 526..557
                          api/types/swarm/runtime/plugin.pb.go on lines 672..703
                          libnetwork/agent.pb.go on lines 873..904
                          libnetwork/networkdb/networkdb.pb.go on lines 2753..2784

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

                          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