dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method Controller.NewNetwork has 21 return statements (exceeds 4 allowed).
Open

func (c *Controller) NewNetwork(networkType, name string, id string, options ...NetworkOption) (_ *Network, retErr error) {
    if id != "" {
        c.networkLocker.Lock(id)
        defer c.networkLocker.Unlock(id) //nolint:errcheck

Severity: Major
Found in libnetwork/controller.go - About 1 hr to fix

    Method driver.CreateEndpoint has 21 return statements (exceeds 4 allowed).
    Open

    func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, _ map[string]interface{}) error {
        if ifInfo == nil {
            return errors.New("invalid interface info passed")
        }
    
    
    Severity: Major
    Found in libnetwork/drivers/bridge/bridge_linux.go - About 1 hr to fix

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

      func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) (retErr error) {
          join := &api.JoinRequest{
              NetworkID:  nid,
              EndpointID: eid,
              SandboxKey: sboxKey,
      Severity: Minor
      Found in libnetwork/drivers/remote/driver.go - About 1 hr 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 NodeEvent.Unmarshal has 21 return statements (exceeds 4 allowed).
      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 1 hr to fix

        Method ImageService.getPushDescriptor has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
        Open

        func (i *ImageService) getPushDescriptor(ctx context.Context, img containerdimages.Image, platform *ocispec.Platform) (ocispec.Descriptor, error) {
            pm := i.matchRequestedOrDefault(platforms.OnlyStrict, platform)
        
            anyMissing := false
        
        
        Severity: Minor
        Found in daemon/containerd/image_push.go - About 1 hr 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 PartialLogEntryMetadata.Unmarshal has 21 return statements (exceeds 4 allowed).
        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 1 hr to fix

          Method reader.drainJournal has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
          Open

          func (r *reader) drainJournal(ctx context.Context) (bool, error) {
              for i := 0; ; i++ {
                  // Read the entry's timestamp.
                  timestamp, err := r.j.Realtime()
                  if err != nil {
          Severity: Minor
          Found in daemon/logger/journald/read.go - About 1 hr 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.foldFilter has 21 return statements (exceeds 4 allowed).
          Open

          func (daemon *Daemon) foldFilter(ctx context.Context, view *container.View, config *containertypes.ListOptions) (*listContext, error) {
              psFilters := config.Filters
          
              var filtExited []int
          
          
          Severity: Major
          Found in daemon/list.go - About 1 hr to fix

            Method Cluster.CreateService has 72 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRegistry bool) (*swarm.ServiceCreateResponse, error) {
                var resp *swarm.ServiceCreateResponse
                err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                    err := c.populateNetworkID(ctx, state.controlClient, &s)
                    if err != nil {
            Severity: Minor
            Found in daemon/cluster/services.go - About 1 hr to fix

              Function convertMount has 72 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func convertMount(m api.Mount) enginemount.Mount {
                  mount := enginemount.Mount{
                      Source:   m.Source,
                      Target:   m.Target,
                      ReadOnly: m.ReadOnly,
              Severity: Minor
              Found in daemon/cluster/executor/container/container.go - About 1 hr to fix

                Function attemptBindHostPorts has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func attemptBindHostPorts(
                    ctx context.Context,
                    cfg []portBindingReq,
                    proto string,
                    hostPortStart, hostPortEnd uint16,
                Severity: Minor
                Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 1 hr to fix

                  Method snapshotter.EnsureLayer has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (s *snapshotter) EnsureLayer(ctx context.Context, key string) ([]layer.DiffID, error) {
                      s.layerCreateLocker.Lock(key)
                      defer s.layerCreateLocker.Unlock(key)
                  
                      diffIDs, err := s.GetDiffIDs(ctx, key)
                  Severity: Minor
                  Found in builder/builder-next/adapters/snapshot/layer.go - About 1 hr to fix

                    Method Reader.testTail has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (tr Reader) testTail(t *testing.T, live bool) {
                        t.Parallel()
                        factory := tr.Factory(t, logger.Info{
                            ContainerID:   "tailtest0000",
                            ContainerName: "logtail",
                    Severity: Minor
                    Found in daemon/logger/loggertest/logreader.go - About 1 hr to fix

                      Method layerStore.registerWithDescriptor has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (ls *layerStore) registerWithDescriptor(ts io.Reader, parent ChainID, descriptor distribution.Descriptor) (Layer, error) {
                          // cErr is used to hold the error which will always trigger
                          // cleanup of creates sources but may not be an error returned
                          // to the caller (already exists).
                          var cErr error
                      Severity: Minor
                      Found in layer/layer_store.go - About 1 hr to fix

                        Method windowsParser.validateMountConfigReg has 20 return statements (exceeds 4 allowed).
                        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: Major
                        Found in volume/mounts/windows_parser.go - About 1 hr to fix

                          Function UnpackLayer has 20 return statements (exceeds 4 allowed).
                          Open

                          func UnpackLayer(dest string, layer io.Reader, options *TarOptions) (size int64, err error) {
                              tr := tar.NewReader(layer)
                              trBuf := pools.BufioReader32KPool.Get(tr)
                              defer pools.BufioReader32KPool.Put(trBuf)
                          
                          
                          Severity: Major
                          Found in pkg/archive/diff.go - About 1 hr to fix

                            Method Daemon.containerAttach has 70 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (daemon *Daemon) containerAttach(c *container.Container, cfg *stream.AttachConfig, logs, doStream bool) error {
                                if logs {
                                    logDriver, logCreated, err := daemon.getLogger(c)
                                    if err != nil {
                                        return err
                            Severity: Minor
                            Found in daemon/attach.go - About 1 hr to fix

                              Method containerAdapter.pullImage has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (c *containerAdapter) pullImage(ctx context.Context) error {
                                  spec := c.container.spec()
                              
                                  // Skip pulling if the image is referenced by image ID.
                                  if _, err := digest.Parse(spec.Image); err == nil {
                              Severity: Minor
                              Found in daemon/cluster/executor/container/adapter.go - About 1 hr to fix

                                Function buildCreateEndpointOptions has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func buildCreateEndpointOptions(c *container.Container, n *libnetwork.Network, epConfig *network.EndpointSettings, sb *libnetwork.Sandbox, daemonDNS []string) ([]libnetwork.EndpointOption, error) {
                                    var createOptions []libnetwork.EndpointOption
                                    genericOptions := make(options.Generic)
                                
                                    nwName := n.Name()
                                Severity: Minor
                                Found in daemon/network.go - About 1 hr to fix

                                  Function StdCopy has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error) {
                                      var (
                                          buf       = make([]byte, startingBufLen)
                                          bufLen    = len(buf)
                                          nr, nw    int
                                  Severity: Minor
                                  Found in pkg/stdcopy/stdcopy.go - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language