dotcloud/docker

View on GitHub

Showing 1,885 of 1,885 total issues

Function getVolume has 5 return statements (exceeds 4 allowed).
Open

func getVolume(ctx context.Context, c swarmapi.ControlClient, input string) (*swarmapi.Volume, error) {
    // GetVolume to match via full ID
    if v, err := c.GetVolume(ctx, &swarmapi.GetVolumeRequest{VolumeID: input}); err == nil {
        return v.Volume, nil
    }
Severity: Major
Found in daemon/cluster/helpers.go - About 35 mins to fix

    Method follow.Do has 5 return statements (exceeds 4 allowed).
    Open

    func (fl *follow) Do(f *os.File, read logPos) {
        fl.log = log.G(context.TODO()).WithFields(log.Fields{
            "module": "logger",
            "file":   f.Name(),
        })
    Severity: Major
    Found in daemon/logger/loggerutils/follow.go - About 35 mins to fix

      Function getEndpointPortMapInfo has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

      func getEndpointPortMapInfo(ep *libnetwork.Endpoint) (nat.PortMap, error) {
          pm := nat.PortMap{}
          driverInfo, err := ep.DriverInfo()
          if err != nil {
              return pm, err
      Severity: Minor
      Found in daemon/network.go - About 35 mins 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 getNetwork has 5 return statements (exceeds 4 allowed).
      Open

      func getNetwork(ctx context.Context, c swarmapi.ControlClient, input string) (*swarmapi.Network, error) {
          // GetNetwork to match via full ID.
          if rg, err := c.GetNetwork(ctx, &swarmapi.GetNetworkRequest{NetworkID: input}); err == nil {
              return rg.Network, nil
          }
      Severity: Major
      Found in daemon/cluster/helpers.go - About 35 mins to fix

        Function New has 5 return statements (exceeds 4 allowed).
        Open

        func New(info logger.Info) (logger.Logger, error) {
            initGCP()
        
            var project string
            if projectID != "" {
        Severity: Major
        Found in daemon/logger/gcplogs/gcplogging.go - About 35 mins to fix

          Function validateContainerConfig has 5 return statements (exceeds 4 allowed).
          Open

          func validateContainerConfig(config *containertypes.Config) error {
              if config == nil {
                  return nil
              }
              if err := translateWorkingDir(config); err != nil {
          Severity: Major
          Found in daemon/container.go - About 35 mins to fix

            Method Daemon.ContainerStart has 5 return statements (exceeds 4 allowed).
            Open

            func (daemon *Daemon) ContainerStart(ctx context.Context, name string, checkpoint string, checkpointDir string) error {
                daemonCfg := daemon.config()
                if checkpoint != "" && !daemonCfg.Experimental {
                    return errdefs.InvalidParameter(errors.New("checkpoint is only supported in experimental mode"))
                }
            Severity: Major
            Found in daemon/start.go - About 35 mins to fix

              Method Daemon.deleteNetwork has 5 return statements (exceeds 4 allowed).
              Open

              func (daemon *Daemon) deleteNetwork(nw *libnetwork.Network, dynamic bool) error {
                  if runconfig.IsPreDefinedNetwork(nw.Name()) && !dynamic {
                      err := fmt.Errorf("%s is a pre-defined network and cannot be removed", nw.Name())
                      return errdefs.Forbidden(err)
                  }
              Severity: Major
              Found in daemon/network.go - About 35 mins to fix

                Function waitUntilFlushedImpl has a Cognitive Complexity of 22 (exceeds 20 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 35 mins 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 pluginAdapterWithRead.ReadLogs has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                Open

                func (a *pluginAdapterWithRead) ReadLogs(config ReadConfig) *LogWatcher {
                    watcher := NewLogWatcher()
                
                    go func() {
                        defer close(watcher.Msg)
                Severity: Minor
                Found in daemon/logger/adapter.go - About 35 mins 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 Copier.copySrc has 5 return statements (exceeds 4 allowed).
                Open

                func (c *Copier) copySrc(name string, src io.Reader) {
                    defer c.copyJobs.Done()
                
                    bufSize := defaultBufSize
                    if sizedLogger, ok := c.dst.(SizedLogger); ok {
                Severity: Major
                Found in daemon/logger/copier.go - About 35 mins to fix

                  Method Daemon.containerPause has 5 return statements (exceeds 4 allowed).
                  Open

                  func (daemon *Daemon) containerPause(container *container.Container) error {
                      container.Lock()
                      defer container.Unlock()
                  
                      // We cannot Pause the container which is not running
                  Severity: Major
                  Found in daemon/pause.go - About 35 mins to fix

                    Function unlink has 5 return statements (exceeds 4 allowed).
                    Open

                    func unlink(name string) error {
                        // Rename the file before deleting it so that the original name is freed
                        // up to be reused, even while there are still open FILE_SHARE_DELETE
                        // file handles. Emulate POSIX unlink() semantics, essentially.
                        name, err := filepath.Abs(name)
                    Severity: Major
                    Found in daemon/logger/loggerutils/file_windows.go - About 35 mins to fix

                      Method splunkLogger.tryPostMessages has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (l *splunkLogger) tryPostMessages(ctx context.Context, messages []*splunkMessage) error {
                          if len(messages) == 0 {
                              return nil
                          }
                          var buffer bytes.Buffer
                      Severity: Minor
                      Found in daemon/logger/splunk/splunk.go - About 35 mins 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.containerRm has 5 return statements (exceeds 4 allowed).
                      Open

                      func (daemon *Daemon) containerRm(cfg *config.Config, name string, opts *backend.ContainerRmConfig) error {
                          start := time.Now()
                          ctr, err := daemon.GetContainer(name)
                          if err != nil {
                              return err
                      Severity: Major
                      Found in daemon/delete.go - About 35 mins to fix

                        Function buildEndpointInfo has 5 return statements (exceeds 4 allowed).
                        Open

                        func buildEndpointInfo(networkSettings *network.Settings, n *libnetwork.Network, ep *libnetwork.Endpoint) error {
                            if ep == nil {
                                return errors.New("endpoint cannot be nil")
                            }
                        
                        
                        Severity: Major
                        Found in daemon/network.go - About 35 mins to fix

                          Function getTask has 5 return statements (exceeds 4 allowed).
                          Open

                          func getTask(ctx context.Context, c swarmapi.ControlClient, input string) (*swarmapi.Task, error) {
                              // GetTask to match via full ID.
                              if rg, err := c.GetTask(ctx, &swarmapi.GetTaskRequest{TaskID: input}); err == nil {
                                  return rg.Task, nil
                              }
                          Severity: Major
                          Found in daemon/cluster/helpers.go - About 35 mins to fix

                            Function verifySplunkConnection has 5 return statements (exceeds 4 allowed).
                            Open

                            func verifySplunkConnection(l *splunkLogger) error {
                                req, err := http.NewRequest(http.MethodOptions, l.url, nil)
                                if err != nil {
                                    return err
                                }
                            Severity: Major
                            Found in daemon/logger/splunk/splunk.go - About 35 mins to fix

                              Method Daemon.killWithSignal has 5 return statements (exceeds 4 allowed).
                              Open

                              func (daemon *Daemon) killWithSignal(container *containerpkg.Container, stopSignal syscall.Signal) error {
                                  log.G(context.TODO()).Debugf("Sending kill signal %d to container %s", stopSignal, container.ID)
                                  container.Lock()
                                  defer container.Unlock()
                              
                              
                              Severity: Major
                              Found in daemon/kill.go - About 35 mins to fix

                                Method Daemon.NetworksPrune has 5 return statements (exceeds 4 allowed).
                                Open

                                func (daemon *Daemon) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (*network.PruneReport, error) {
                                    if !atomic.CompareAndSwapInt32(&daemon.pruneRunning, 0, 1) {
                                        return nil, errPruneRunning
                                    }
                                    defer atomic.StoreInt32(&daemon.pruneRunning, 0)
                                Severity: Major
                                Found in daemon/prune.go - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language