dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

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

func New(info logger.Info) (logger.Logger, error) {
    hostname, err := info.Hostname()
    if err != nil {
        return nil, fmt.Errorf("%s: cannot access hostname to set source field", driverName)
    }
Severity: Major
Found in daemon/logger/splunk/splunk.go - About 5 hrs to fix

    Method Daemon.registerMountPoints has 166 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (daemon *Daemon) registerMountPoints(container *container.Container, hostConfig *containertypes.HostConfig, defaultReadOnlyNonRecursive bool) (retErr error) {
        binds := map[string]bool{}
        mountPoints := map[string]*volumemounts.MountPoint{}
        parser := volumemounts.NewParser()
    
    
    Severity: Major
    Found in daemon/volumes.go - About 5 hrs to fix

      Method Controller.reservePools has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
      Open

      func (c *Controller) reservePools() {
          networks, err := c.getNetworks()
          if err != nil {
              log.G(context.TODO()).Warnf("Could not retrieve networks from local store during ipam allocation for existing networks: %v", err)
              return
      Severity: Minor
      Found in libnetwork/controller.go - About 5 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 ImageService.setupFilters has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
      Open

      func (i *ImageService) setupFilters(ctx context.Context, imageFilters filters.Args) (filterFunc imageFilterFunc, outErr error) {
          var fltrs []imageFilterFunc
          err := imageFilters.WalkValues("before", func(value string) error {
              img, err := i.GetImage(ctx, value, backend.GetImageOpts{})
              if err != nil {
      Severity: Minor
      Found in daemon/containerd/image_list.go - About 5 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

      Function changes has a Cognitive Complexity of 52 (exceeds 20 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 5 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 Plugin.Set has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
      Open

      func (p *Plugin) Set(args []string) error {
          p.mu.Lock()
          defer p.mu.Unlock()
      
          if p.PluginObj.Enabled {
      Severity: Minor
      Found in plugin/v2/plugin.go - About 5 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 windowsParser.validateMountConfigReg has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
      Open

      func (p *windowsParser) validateMountConfigReg(mnt *mount.Mount, additionalValidators ...mountValidator) error {
          if len(mnt.Target) == 0 {
              return &errMountConfig{mnt, errMissingField("Target")}
          }
          for _, v := range additionalValidators {
      Severity: Minor
      Found in volume/mounts/windows_parser.go - About 5 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 Info.ExtraAttributes has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
      Open

      func (info *Info) ExtraAttributes(keyMod func(string) string) (map[string]string, error) {
          extra := make(map[string]string)
          labels, ok := info.Config["labels"]
          if ok && len(labels) > 0 {
              for _, l := range strings.Split(labels, ",") {
      Severity: Minor
      Found in daemon/logger/loginfo.go - About 5 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 Daemon.containerStart has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
      Open

      func (daemon *Daemon) containerStart(ctx context.Context, daemonCfg *configStore, container *container.Container, checkpoint string, checkpointDir string, resetRestartManager bool) (retErr error) {
          ctx, span := otel.Tracer("").Start(ctx, "daemon.containerStart", trace.WithAttributes(
              attribute.String("container.ID", container.ID),
              attribute.String("container.Name", container.Name)))
          defer span.End()
      Severity: Minor
      Found in daemon/start.go - About 5 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 tarSum.Read has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
      Open

      func (ts *tarSum) Read(buf []byte) (int, error) {
          if ts.finished {
              return ts.bufWriter.Read(buf)
          }
          if len(ts.bufData) < len(buf) {
      Severity: Minor
      Found in pkg/tarsum/tarsum.go - About 5 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

      Controller has 40 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type Controller struct {
          id               string
          drvRegistry      drvregistry.Networks
          ipamRegistry     drvregistry.IPAMs
          sandboxes        map[string]*Sandbox
      Severity: Minor
      Found in libnetwork/controller.go - About 5 hrs to fix

        Method EndpointRecord.Unmarshal has 61 return statements (exceeds 4 allowed).
        Open

        func (m *EndpointRecord) Unmarshal(dAtA []byte) error {
            l := len(dAtA)
            iNdEx := 0
            for iNdEx < l {
                preIndex := iNdEx
        Severity: Major
        Found in libnetwork/agent.pb.go - About 5 hrs to fix

          Method linuxParser.validateMountConfigImpl has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
          Open

          func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSourceExists bool) error {
              if len(mnt.Target) == 0 {
                  return &errMountConfig{mnt, errMissingField("Target")}
              }
          
          
          Severity: Minor
          Found in volume/mounts/linux_parser.go - About 5 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 Daemon.ProcessEvent has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei libcontainerdtypes.EventInfo) error {
              c, err := daemon.GetContainer(id)
              if err != nil {
                  return errors.Wrapf(err, "could not find container %s", id)
              }
          Severity: Minor
          Found in daemon/monitor.go - About 5 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 containerRouter.postContainersCreate has 154 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (c *containerRouter) postContainersCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
              if err := httputils.ParseForm(r); err != nil {
                  return err
              }
              if err := httputils.CheckForJSON(r); err != nil {
          Severity: Major
          Found in api/server/router/container/container_routes.go - About 5 hrs to fix

            File client.go has 628 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package remote // import "github.com/docker/docker/libcontainerd/remote"
            
            import (
                "context"
                "encoding/json"
            Severity: Minor
            Found in libcontainerd/remote/client.go - About 5 hrs to fix

              Function withMounts has 151 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func withMounts(daemon *Daemon, daemonCfg *configStore, c *container.Container, mounts []container.Mount) coci.SpecOpts {
                  return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) (err error) {
                      sortMounts(mounts)
              
                      userMounts := make(map[string]struct{})
              Severity: Major
              Found in daemon/oci_linux.go - About 5 hrs to fix

                Endpoint has 38 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type Endpoint struct {
                    name         string
                    id           string
                    network      *Network
                    iface        *EndpointInterface
                Severity: Minor
                Found in libnetwork/endpoint.go - About 5 hrs to fix

                  Method NetworkEntry.Unmarshal has 150 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (m *NetworkEntry) Unmarshal(dAtA []byte) error {
                      l := len(dAtA)
                      iNdEx := 0
                      for iNdEx < l {
                          preIndex := iNdEx
                  Severity: Major
                  Found in libnetwork/networkdb/networkdb.pb.go - About 5 hrs to fix

                    Method NetworkEvent.Unmarshal has 149 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (m *NetworkEvent) Unmarshal(dAtA []byte) error {
                        l := len(dAtA)
                        iNdEx := 0
                        for iNdEx < l {
                            preIndex := iNdEx
                    Severity: Major
                    Found in libnetwork/networkdb/networkdb.pb.go - About 4 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language