dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

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

func (c *Cluster) GetVolume(nameOrID string) (volumetypes.Volume, error) {
    var volume *swarmapi.Volume

    if err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
        v, err := getVolume(ctx, state.controlClient, nameOrID)
Severity: Major
Found in daemon/cluster/volumes.go and 2 other locations - About 1 hr to fix
daemon/cluster/configs.go on lines 14..28
daemon/cluster/secrets.go on lines 14..28

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

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 dbTableEntriesNumber(ip, port, networkName, tableName string, doneCh chan resultTuple) {
    body, err := httpGet(ip, port, "/gettable?nid="+networkName+"&tname="+tableName)
    if err != nil {
        log.G(context.TODO()).Errorf("tableEntriesNumber %s there was an error: %s", ip, err)
        doneCh <- resultTuple{id: ip, result: -1}
Severity: Major
Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go and 1 other location - About 1 hr to fix
libnetwork/cmd/networkdb-test/dbclient/ndbClient.go on lines 136..146

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

package client // import "github.com/docker/docker/client"

import (
    "context"
    "net/url"
Severity: Major
Found in client/secret_update.go and 1 other location - About 1 hr to fix
client/config_update.go on lines 1..20

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

package client // import "github.com/docker/docker/client"

import (
    "context"
    "net/url"
Severity: Major
Found in client/config_update.go and 1 other location - About 1 hr to fix
client/secret_update.go on lines 1..20

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

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 clientTableEntriesNumber(ip, port, networkName, tableName string, doneCh chan resultTuple) {
    body, err := httpGet(ip, port, "/watchedtableentries?nid="+networkName+"&tname="+tableName)
    if err != nil {
        log.G(context.TODO()).Errorf("clientTableEntriesNumber %s there was an error: %s", ip, err)
        doneCh <- resultTuple{id: ip, result: -1}
Severity: Major
Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go and 1 other location - About 1 hr to fix
libnetwork/cmd/networkdb-test/dbclient/ndbClient.go on lines 105..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 169.

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 puller.pullManifestList has 66 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfstList *manifestlist.DeserializedManifestList, pp *ocispec.Platform) (id digest.Digest, manifestListDigest digest.Digest, err error) {
    manifestListDigest, err = schema2ManifestDigest(ref, mfstList)
    if err != nil {
        return "", "", err
    }
Severity: Minor
Found in distribution/pull_v2.go - About 1 hr to fix

    Method cnmNetworkAllocator.allocatePools has 66 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (na *cnmNetworkAllocator) allocatePools(n *api.Network) (map[string]string, error) {
        ipam, dName, dOptions, err := na.resolveIPAM(n)
        if err != nil {
            return nil, err
        }
    Severity: Minor
    Found in libnetwork/cnmallocator/networkallocator.go - About 1 hr to fix

      Function normalizeLayersAndHistory has 66 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func normalizeLayersAndHistory(diffs []digest.Digest, history []ocispec.History, ref cache.ImmutableRef) ([]digest.Digest, []ocispec.History) {
          refMeta := getRefMetadata(ref, len(diffs))
          var historyLayers int
          for _, h := range history {
              if !h.EmptyLayer {
      Severity: Minor
      Found in builder/builder-next/exporter/mobyexporter/writer.go - About 1 hr to fix

        Method containerRouter.postContainerExecStart has 66 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (s *containerRouter) postContainerExecStart(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
            if err := httputils.ParseForm(r); err != nil {
                return err
            }
        
        
        Severity: Minor
        Found in api/server/router/container/exec.go - About 1 hr to fix

          Method nodeRunner.start has 66 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (n *nodeRunner) start(conf nodeStartConfig) error {
              var control string
              if isWindows {
                  control = `\\.\pipe\` + controlSocket
              } else {
          Severity: Minor
          Found in daemon/cluster/noderunner.go - About 1 hr to fix

            Method Daemon.cleanupContainer has 66 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (daemon *Daemon) cleanupContainer(container *container.Container, config backend.ContainerRmConfig) error {
                if container.IsRunning() {
                    if !config.ForceRemove {
                        if state := container.StateString(); state == "paused" {
                            return errdefs.Conflict(fmt.Errorf("cannot remove container %q: container is %s and must be unpaused first", container.Name, state))
            Severity: Minor
            Found in daemon/delete.go - About 1 hr to fix

              Method Daemon.containerExtractToDir has 66 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (daemon *Daemon) containerExtractToDir(container *container.Container, path string, copyUIDGID, noOverwriteDirNonDir bool, content io.Reader) (err error) {
                  container.Lock()
                  defer container.Unlock()
              
                  // Make sure an online file-system operation is permitted.
              Severity: Minor
              Found in daemon/archive_windows.go - About 1 hr to fix

                Method ImageService.SquashImage has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (i *ImageService) SquashImage(id, parent string) (string, error) {
                    var (
                        img *image.Image
                        err error
                    )
                Severity: Minor
                Found in daemon/images/image_squash.go - About 1 hr to fix

                  Function changes has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func changes(layers []string, rw string, dc deleteChange, sc skipChange) ([]Change, error) {
                      var (
                          changes     []Change
                          changedDirs = make(map[string]struct{})
                      )
                  Severity: Minor
                  Found in pkg/archive/changes.go - About 1 hr to fix

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

                        fPol := &netlink.XfrmPolicy{
                            Src:     &net.IPNet{IP: s, Mask: fullMask},
                            Dst:     &net.IPNet{IP: d, Mask: fullMask},
                            Dir:     netlink.XFRM_DIR_OUT,
                            Proto:   syscall.IPPROTO_UDP,
                    Severity: Major
                    Found in libnetwork/drivers/overlay/encryption.go and 1 other location - About 1 hr to fix
                    libnetwork/drivers/overlay/encryption.go on lines 610..627

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

                    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

                            fSP1 := &netlink.XfrmPolicy{
                                Src:     &net.IPNet{IP: s, Mask: fullMask},
                                Dst:     &net.IPNet{IP: d, Mask: fullMask},
                                Dir:     netlink.XFRM_DIR_OUT,
                                Proto:   syscall.IPPROTO_UDP,
                    Severity: Major
                    Found in libnetwork/drivers/overlay/encryption.go and 1 other location - About 1 hr to fix
                    libnetwork/drivers/overlay/encryption.go on lines 396..413

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

                    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 (i *ImageService) CommitBuildStep(ctx context.Context, c backend.CommitConfig) (image.ID, error) {
                        ctr := i.containers.Get(c.ContainerID)
                        if ctr == nil {
                            // TODO: use typed error
                            return "", fmt.Errorf("container not found: %s", c.ContainerID)
                    Severity: Major
                    Found in daemon/containerd/image_commit.go and 1 other location - About 1 hr to fix
                    daemon/images/image_commit.go on lines 124..134

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

                    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 (i *ImageService) CommitBuildStep(ctx context.Context, c backend.CommitConfig) (image.ID, error) {
                        ctr := i.containers.Get(c.ContainerID)
                        if ctr == nil {
                            // TODO: use typed error
                            return "", errors.Errorf("container not found: %s", c.ContainerID)
                    Severity: Major
                    Found in daemon/images/image_commit.go and 1 other location - About 1 hr to fix
                    daemon/containerd/image_commit.go on lines 321..331

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

                    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 LayerDownloadManager.makeDownloadFuncFromDownload has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor DownloadDescriptor, sourceDownload *downloadTransfer, parentDownload *downloadTransfer) doFunc {
                        return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) transfer {
                            d := &downloadTransfer{
                                transfer:   newTransfer(),
                                layerStore: ldm.layerStore,
                    Severity: Minor
                    Found in distribution/xfer/download.go - About 1 hr to fix

                      Method NetworkDB.clusterInit has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (nDB *NetworkDB) clusterInit() error {
                          nDB.lastStatsTimestamp = time.Now()
                          nDB.lastHealthTimestamp = nDB.lastStatsTimestamp
                      
                          config := memberlist.DefaultLANConfig()
                      Severity: Minor
                      Found in libnetwork/networkdb/cluster.go - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language