dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method bridgeNetwork.addPortMappings has 122 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (n *bridgeNetwork) addPortMappings(
    ctx context.Context,
    epAddrV4, epAddrV6 *net.IPNet,
    cfg []types.PortBinding,
    defHostIP net.IP,
Severity: Major
Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 3 hrs to fix

    Method ImageService.ExportImage has 119 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (i *ImageService) ExportImage(ctx context.Context, names []string, platform *ocispec.Platform, outStream io.Writer) error {
        pm := i.matchRequestedOrDefault(platforms.OnlyStrict, platform)
    
        opts := []archive.ExportOpt{
            archive.WithSkipNonDistributableBlobs(),
    Severity: Major
    Found in daemon/containerd/image_exporter.go - About 3 hrs to fix

      Function containerSpecFromGRPC has 119 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func containerSpecFromGRPC(c *swarmapi.ContainerSpec) *types.ContainerSpec {
          if c == nil {
              return nil
          }
          containerSpec := &types.ContainerSpec{
      Severity: Major
      Found in daemon/cluster/convert/container.go - About 3 hrs to fix

        Method driver.CreateNetwork has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
        Open

        func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
            var (
                networkName   string
                interfaceName string
                staleNetworks []string
        Severity: Minor
        Found in libnetwork/drivers/windows/overlay/ov_network_windows.go - About 3 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 View.transform has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
        Open

        func (v *View) transform(ctr *Container) *Snapshot {
            health := container.NoHealthcheck
            if ctr.Health != nil {
                health = ctr.Health.Status()
            }
        Severity: Minor
        Found in container/view.go - About 3 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 networkRouter.getNetwork has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
        Open

        func (n *networkRouter) getNetwork(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/network/network_routes.go - About 3 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 LocalRegistry.Scan has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
        Open

        func (l *LocalRegistry) Scan() ([]string, error) {
            var names []string
            dirEntries, err := os.ReadDir(l.socketsPath)
            if err != nil && !os.IsNotExist(err) {
                return nil, errors.Wrap(err, "error reading dir entries")
        Severity: Minor
        Found in pkg/plugins/discovery.go - About 3 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 driver.CreateEndpoint has 118 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
            ctx, span := otel.Tracer("").Start(ctx, fmt.Sprintf("libnetwork.drivers.windows_%s.CreateEndpoint", d.name), trace.WithAttributes(
                attribute.String("nid", nid),
                attribute.String("eid", eid)))
            defer span.End()
        Severity: Major
        Found in libnetwork/drivers/windows/windows.go - About 3 hrs to fix

          Method PartialLogEntryMetadata.Unmarshal has 118 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (m *PartialLogEntryMetadata) Unmarshal(dAtA []byte) error {
              l := len(dAtA)
              iNdEx := 0
              for iNdEx < l {
                  preIndex := iNdEx
          Severity: Major
          Found in api/types/plugins/logdriver/entry.pb.go - About 3 hrs to fix

            Method NodeEvent.Unmarshal has 117 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

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

              swarmRouter has 30 methods (exceeds 20 allowed). Consider refactoring.
              Open

              func (sr *swarmRouter) initCluster(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                  var req types.InitRequest
                  if err := httputils.ReadJSON(r, &req); err != nil {
                      return err
                  }
              Severity: Minor
              Found in api/server/router/swarm/cluster_routes.go - About 3 hrs to fix

                Method driver.CreateNetwork has 116 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
                    if _, err := d.getNetwork(id); err == nil {
                        return types.ForbiddenErrorf("network %s exists", id)
                    }
                
                
                Severity: Major
                Found in libnetwork/drivers/windows/windows.go - About 3 hrs to fix

                  Function splitConfigRootFSFromTar has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func splitConfigRootFSFromTar(in io.ReadCloser, config *[]byte) io.ReadCloser {
                      pr, pw := io.Pipe()
                      go func() {
                          tarReader := tar.NewReader(in)
                          tarWriter := tar.NewWriter(pw)
                  Severity: Minor
                  Found in plugin/backend_linux.go - About 3 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 Controller.handleKeyChange has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (c *Controller) handleKeyChange(keys []*types.EncryptionKey) error {
                      drvEnc := discoverapi.DriverEncryptionUpdate{}
                  
                      agent := c.getAgent()
                      if agent == nil {
                  Severity: Minor
                  Found in libnetwork/agent.go - About 3 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.resolveImage has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (i *ImageService) resolveImage(ctx context.Context, refOrID string) (containerdimages.Image, error) {
                      parsed, err := reference.ParseAnyReference(refOrID)
                      if err != nil {
                          return containerdimages.Image{}, errdefs.InvalidParameter(err)
                      }
                  Severity: Minor
                  Found in daemon/containerd/image.go - About 3 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 WithDevices has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func WithDevices(daemon *Daemon, c *container.Container) coci.SpecOpts {
                      return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
                          // Build lists of devices allowed and created within the container.
                          var devs []specs.LinuxDevice
                          devPermissions := s.Linux.Resources.Devices
                  Severity: Minor
                  Found in daemon/oci_linux.go - About 3 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 View.transform has 114 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (v *View) transform(ctr *Container) *Snapshot {
                      health := container.NoHealthcheck
                      if ctr.Health != nil {
                          health = ctr.Health.Status()
                      }
                  Severity: Major
                  Found in container/view.go - About 3 hrs to fix

                    Method Daemon.ProcessEvent has 114 lines of code (exceeds 50 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: Major
                    Found in daemon/monitor.go - About 3 hrs to fix

                      Method ImageService.Images has 113 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (i *ImageService) Images(ctx context.Context, opts imagetypes.ListOptions) ([]*imagetypes.Summary, error) {
                          if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
                              return nil, err
                          }
                      
                      
                      Severity: Major
                      Found in daemon/containerd/image_list.go - About 3 hrs to fix

                        Daemon has 29 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (daemon *Daemon) NetworkControllerEnabled() bool {
                            return daemon.netController != nil
                        }
                        Severity: Minor
                        Found in daemon/network.go - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language