dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Function writeContentsForImage has 54 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func writeContentsForImage(ctx context.Context, snName string, cs content.Store,
    newConfig imagespec.DockerOCIImage, layers []ocispec.Descriptor,
    containerConfig container.Config,
) (
    manifestDesc ocispec.Descriptor,
Severity: Minor
Found in daemon/containerd/image_builder.go - About 1 hr to fix

    Method pullProgress.UpdateProgress has 54 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (p pullProgress) UpdateProgress(ctx context.Context, ongoing *jobs, out progress.Output, start time.Time) error {
        actives, err := p.store.ListStatuses(ctx, "")
        if err != nil {
            if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
                return err
    Severity: Minor
    Found in daemon/containerd/progress.go - About 1 hr to fix

      Method Daemon.ContainerTop has 54 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (daemon *Daemon) ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error) {
          if psArgs == "" {
              psArgs = "-ef"
          }
      
      
      Severity: Minor
      Found in daemon/top_unix.go - About 1 hr to fix

        Method ImageService.ImportImage has 54 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (i *ImageService) ImportImage(ctx context.Context, newRef reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error) {
            if platform == nil {
                def := platforms.DefaultSpec()
                platform = &def
            }
        Severity: Minor
        Found in daemon/images/image_import.go - About 1 hr to fix

          Method Daemon.update has 54 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) error {
              if hostConfig == nil {
                  return nil
              }
          
          
          Severity: Minor
          Found in daemon/update.go - About 1 hr to fix

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

                        if ep.addrv6 != nil {
                            default6Route, err := ifaceGateway(defaultV6RouteCidr)
                            if err != nil {
                                return err
                            }
            Severity: Major
            Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go and 1 other location - About 1 hr to fix
            libnetwork/drivers/ipvlan/ipvlan_joinleave.go on lines 68..78

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

            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

                        if ep.addr != nil {
                            defaultRoute, err := ifaceGateway(defaultV4RouteCidr)
                            if err != nil {
                                return err
                            }
            Severity: Major
            Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go and 1 other location - About 1 hr to fix
            libnetwork/drivers/ipvlan/ipvlan_joinleave.go on lines 80..90

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

            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

                if len(r.Form["tname"]) < 1 ||
                    len(r.Form["nid"]) < 1 ||
                    len(r.Form["key"]) < 1 ||
                    len(r.Form["value"]) < 1 {
                    rsp := diagnostic.WrongCommand(missingParameter, fmt.Sprintf("%s?tname=table_name&nid=network_id&key=k&value=v", r.URL.Path))
            Severity: Major
            Found in libnetwork/networkdb/networkdbdiagnostic.go and 1 other location - About 1 hr to fix
            libnetwork/networkdb/networkdbdiagnostic.go on lines 142..150

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

            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

                if len(r.Form["tname"]) < 1 ||
                    len(r.Form["nid"]) < 1 ||
                    len(r.Form["key"]) < 1 ||
                    len(r.Form["value"]) < 1 {
                    rsp := diagnostic.WrongCommand(missingParameter, fmt.Sprintf("%s?tname=table_name&nid=network_id&key=k&value=v", r.URL.Path))
            Severity: Major
            Found in libnetwork/networkdb/networkdbdiagnostic.go and 1 other location - About 1 hr to fix
            libnetwork/networkdb/networkdbdiagnostic.go on lines 191..199

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

            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 Controller.rmServiceBinding has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (c *Controller) rmServiceBinding(svcName, svcID, nID, eID, containerName string, vip net.IP, ingressPorts []*PortConfig, serviceAliases []string, taskAliases []string, ip net.IP, method string, deleteSvcRecords bool, fullRemove bool) error {
            Severity: Major
            Found in libnetwork/service_common.go - About 1 hr to fix

              Function kubernetesSafeOpen has 53 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func kubernetesSafeOpen(base, subpath string) (int, error) {
                  // syscall.Openat flags used to traverse directories not following symlinks
                  const nofollowFlags = unix.O_RDONLY | unix.O_NOFOLLOW
                  // flags for getting file descriptor without following the symlink
                  const openFDFlags = unix.O_NOFOLLOW | unix.O_PATH
              Severity: Minor
              Found in internal/safepath/k8s_safeopen_linux.go - About 1 hr to fix

                Method transferManager.transfer has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (tm *transferManager) transfer(key string, xferFunc doFunc, progressOutput progress.Output) (transfer, *watcher) {
                    tm.mu.Lock()
                    defer tm.mu.Unlock()
                
                    for {
                Severity: Minor
                Found in distribution/xfer/transfer.go - About 1 hr to fix

                  Function main has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func main() {
                      ipPtr := flag.String("ip", "127.0.0.1", "ip address")
                      portPtr := flag.Int("port", 2000, "port")
                      networkPtr := flag.String("net", "", "target network")
                      tablePtr := flag.String("t", "", "table to process <sd/overlay>")
                  Severity: Minor
                  Found in libnetwork/cmd/diagnostic/main.go - About 1 hr to fix

                    Method driver.DiscoverNew has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
                        switch dType {
                        case discoverapi.NodeDiscovery:
                            nodeData, ok := data.(discoverapi.NodeDiscoveryData)
                            if !ok {
                    Severity: Minor
                    Found in libnetwork/drivers/overlay/overlay.go - About 1 hr to fix

                      Function dispatchRun has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func dispatchRun(ctx context.Context, d dispatchRequest, c *instructions.RunCommand) error {
                          if err := image.CheckOS(d.state.operatingSystem); err != nil {
                              return err
                          }
                      
                      
                      Severity: Minor
                      Found in builder/dockerfile/dispatchers.go - About 1 hr to fix

                        Method ImageService.GetImageAndReleasableLayer has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (i *ImageService) GetImageAndReleasableLayer(ctx context.Context, refOrID string, opts backend.GetImageAndLayerOptions) (builder.Image, builder.ROLayer, error) {
                            if refOrID == "" { // FROM scratch
                                if runtime.GOOS == "windows" {
                                    return nil, nil, fmt.Errorf(`"FROM scratch" is not supported on Windows`)
                                }
                        Severity: Minor
                        Found in daemon/containerd/image_builder.go - About 1 hr to fix

                          Method Daemon.containerArchivePath has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (daemon *Daemon) containerArchivePath(container *container.Container, path string) (content io.ReadCloser, stat *containertypes.PathStat, err error) {
                              container.Lock()
                          
                              defer func() {
                                  if err != nil {
                          Severity: Minor
                          Found in daemon/archive_windows.go - About 1 hr to fix

                            Method ImageService.CommitImage has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (i *ImageService) CommitImage(ctx context.Context, c backend.CommitConfig) (image.ID, error) {
                                if err := ctx.Err(); err != nil {
                                    return "", err
                                }
                            
                            
                            Severity: Minor
                            Found in daemon/images/image_commit.go - About 1 hr to fix

                              Method JSONProgress.String has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (p *JSONProgress) String() string {
                                  var (
                                      width       = p.width()
                                      pbBox       string
                                      numbersBox  string
                              Severity: Minor
                              Found in pkg/jsonmessage/jsonmessage.go - About 1 hr to fix

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

                                    if !parentExists(config.Parent) {
                                        // Create a dummy link if a dummy name is set for parent
                                        if dummyName := getDummyName(config.ID); dummyName == config.Parent {
                                            err := createDummyLink(config.Parent, dummyName)
                                            if err != nil {
                                Severity: Major
                                Found in libnetwork/drivers/ipvlan/ipvlan_network.go and 1 other location - About 1 hr to fix
                                libnetwork/drivers/macvlan/macvlan_network.go on lines 92..123

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

                                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