dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method imageRouter.postImagesPush has 55 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (ir *imageRouter) postImagesPush(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    metaHeaders := map[string][]string{}
    for k, v := range r.Header {
        if strings.HasPrefix(k, "X-Meta-") {
            metaHeaders[k] = v
Severity: Minor
Found in api/server/router/image/image_routes.go - About 1 hr to fix

    Function withCommonOptions has 55 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func withCommonOptions(daemon *Daemon, daemonCfg *dconfig.Config, c *container.Container) coci.SpecOpts {
        return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
            if c.BaseFS == "" {
                return errors.New("populateCommonSpec: BaseFS of container " + c.ID + " is unexpectedly empty")
            }
    Severity: Minor
    Found in daemon/oci_linux.go - About 1 hr to fix

      Method ImageService.deleteAll has 55 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (i *ImageService) deleteAll(ctx context.Context, imgID image.ID, all []images.Image, c conflictType, prune bool) (records []imagetypes.DeleteResponse, err error) {
          // Workaround for: https://github.com/moby/buildkit/issues/3797
          possiblyDeletedConfigs := map[digest.Digest]struct{}{}
          if len(all) > 0 && i.content != nil {
              handled := map[digest.Digest]struct{}{}
      Severity: Minor
      Found in daemon/containerd/image_delete.go - About 1 hr to fix

        Function New has 55 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func New(info logger.Info) (logger.Logger, error) {
            containerStreamConfig, err := newStreamConfig(info)
            if err != nil {
                return nil, err
            }
        Severity: Minor
        Found in daemon/logger/awslogs/cloudwatchlogs.go - About 1 hr to fix

          Function SwarmFromGRPC has 55 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func SwarmFromGRPC(c swarmapi.Cluster) types.Swarm {
              swarm := types.Swarm{
                  ClusterInfo: types.ClusterInfo{
                      ID: c.ID,
                      Spec: types.Spec{
          Severity: Minor
          Found in daemon/cluster/convert/swarm.go - About 1 hr to fix

            Function New has 55 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func New(info logger.Info) (logger.Logger, error) {
                // parse gelf address
                address, err := parseAddress(info.Config["gelf-address"])
                if err != nil {
                    return nil, err
            Severity: Minor
            Found in daemon/logger/gelf/gelf.go - About 1 hr to fix

              Method reader.readLogs has 55 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (r *reader) readLogs(ctx context.Context) {
                  defer close(r.logWatcher.Msg)
              
                  // Make sure the ready channel is closed in the event of an early
                  // return.
              Severity: Minor
              Found in daemon/logger/journald/read.go - About 1 hr to fix

                Function waitUntilFlushedImpl has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func waitUntilFlushedImpl(s *journald) error {
                    if s.readSyncTimeout == 0 {
                        return nil
                    }
                
                
                Severity: Minor
                Found in daemon/logger/journald/read.go - About 1 hr to fix

                  Function toContainerdResources has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func toContainerdResources(resources container.Resources) *libcontainerdtypes.Resources {
                      var r libcontainerdtypes.Resources
                  
                      if resources.BlkioWeight != 0 {
                          r.BlockIO = &specs.LinuxBlockIO{
                  Severity: Minor
                  Found in daemon/update_linux.go - About 1 hr to fix

                    Method Daemon.containerCopy has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (daemon *Daemon) containerCopy(container *container.Container, resource string) (rc io.ReadCloser, err error) {
                        if resource[0] == '/' || resource[0] == '\\' {
                            resource = resource[1:]
                        }
                        container.Lock()
                    Severity: Minor
                    Found in daemon/archive_windows.go - About 1 hr to fix

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

                              case 4:
                                  if wireType != 0 {
                                      return fmt.Errorf("proto: wrong wireType = %d for field Disabled", wireType)
                                  }
                                  var v int
                      Severity: Major
                      Found in api/types/swarm/runtime/plugin.pb.go and 5 other locations - About 1 hr to fix
                      api/types/plugins/logdriver/entry.pb.go on lines 474..493
                      api/types/plugins/logdriver/entry.pb.go on lines 580..599
                      libnetwork/agent.pb.go on lines 905..924
                      libnetwork/networkdb/networkdb.pb.go on lines 2208..2227
                      libnetwork/networkdb/networkdb.pb.go on lines 2701..2720

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

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

                              case 9:
                                  if wireType != 0 {
                                      return fmt.Errorf("proto: wrong wireType = %d for field ServiceDisabled", wireType)
                                  }
                                  var v int
                      Severity: Major
                      Found in libnetwork/agent.pb.go and 5 other locations - About 1 hr to fix
                      api/types/plugins/logdriver/entry.pb.go on lines 474..493
                      api/types/plugins/logdriver/entry.pb.go on lines 580..599
                      api/types/swarm/runtime/plugin.pb.go on lines 506..525
                      libnetwork/networkdb/networkdb.pb.go on lines 2208..2227
                      libnetwork/networkdb/networkdb.pb.go on lines 2701..2720

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

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

                              case 4:
                                  if wireType != 0 {
                                      return fmt.Errorf("proto: wrong wireType = %d for field Leaving", wireType)
                                  }
                                  var v int
                      Severity: Major
                      Found in libnetwork/networkdb/networkdb.pb.go and 5 other locations - About 1 hr to fix
                      api/types/plugins/logdriver/entry.pb.go on lines 474..493
                      api/types/plugins/logdriver/entry.pb.go on lines 580..599
                      api/types/swarm/runtime/plugin.pb.go on lines 506..525
                      libnetwork/agent.pb.go on lines 905..924
                      libnetwork/networkdb/networkdb.pb.go on lines 2701..2720

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

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

                              case 4:
                                  if wireType != 0 {
                                      return fmt.Errorf("proto: wrong wireType = %d for field Partial", wireType)
                                  }
                                  var v int
                      Severity: Major
                      Found in api/types/plugins/logdriver/entry.pb.go and 5 other locations - About 1 hr to fix
                      api/types/plugins/logdriver/entry.pb.go on lines 580..599
                      api/types/swarm/runtime/plugin.pb.go on lines 506..525
                      libnetwork/agent.pb.go on lines 905..924
                      libnetwork/networkdb/networkdb.pb.go on lines 2208..2227
                      libnetwork/networkdb/networkdb.pb.go on lines 2701..2720

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

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

                              case 2:
                                  if wireType != 0 {
                                      return fmt.Errorf("proto: wrong wireType = %d for field Unsolicited", wireType)
                                  }
                                  var v int
                      Severity: Major
                      Found in libnetwork/networkdb/networkdb.pb.go and 5 other locations - About 1 hr to fix
                      api/types/plugins/logdriver/entry.pb.go on lines 474..493
                      api/types/plugins/logdriver/entry.pb.go on lines 580..599
                      api/types/swarm/runtime/plugin.pb.go on lines 506..525
                      libnetwork/agent.pb.go on lines 905..924
                      libnetwork/networkdb/networkdb.pb.go on lines 2208..2227

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

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

                              case 1:
                                  if wireType != 0 {
                                      return fmt.Errorf("proto: wrong wireType = %d for field Last", wireType)
                                  }
                                  var v int
                      Severity: Major
                      Found in api/types/plugins/logdriver/entry.pb.go and 5 other locations - About 1 hr to fix
                      api/types/plugins/logdriver/entry.pb.go on lines 474..493
                      api/types/swarm/runtime/plugin.pb.go on lines 506..525
                      libnetwork/agent.pb.go on lines 905..924
                      libnetwork/networkdb/networkdb.pb.go on lines 2208..2227
                      libnetwork/networkdb/networkdb.pb.go on lines 2701..2720

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

                      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

                          case *net.UDPAddr:
                              proto = "udp"
                      
                              var err error
                              allocatedHostPort, err = pm.allocator.RequestPortInRange(hostIP, proto, hostPortStart, hostPortEnd)
                      Severity: Major
                      Found in libnetwork/portmapper/mapper.go and 1 other location - About 1 hr to fix
                      libnetwork/portmapper/mapper.go on lines 60..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 142.

                      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

                          case *net.TCPAddr:
                              proto = "tcp"
                      
                              var err error
                              allocatedHostPort, err = pm.allocator.RequestPortInRange(hostIP, proto, hostPortStart, hostPortEnd)
                      Severity: Major
                      Found in libnetwork/portmapper/mapper.go and 1 other location - About 1 hr to fix
                      libnetwork/portmapper/mapper.go on lines 79..97

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

                      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 (d *driver) storeUpdate(kvObject datastore.KVObject) error {
                          if d.store == nil {
                              log.G(context.TODO()).Warnf("macvlan store not initialized. kv object %s is not added to the store", datastore.Key(kvObject.Key()...))
                              return nil
                          }
                      Severity: Major
                      Found in libnetwork/drivers/macvlan/macvlan_store.go and 1 other location - About 1 hr to fix
                      libnetwork/drivers/ipvlan/ipvlan_store.go on lines 114..124

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

                      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 (d *driver) storeUpdate(kvObject datastore.KVObject) error {
                          if d.store == nil {
                              log.G(context.TODO()).Warnf("ipvlan store not initialized. kv object %s is not added to the store", datastore.Key(kvObject.Key()...))
                              return nil
                          }
                      Severity: Major
                      Found in libnetwork/drivers/ipvlan/ipvlan_store.go and 1 other location - About 1 hr to fix
                      libnetwork/drivers/macvlan/macvlan_store.go on lines 113..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 141.

                      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