dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method Daemon.setupConfigDir has 7 return statements (exceeds 4 allowed).
Open

func (daemon *Daemon) setupConfigDir(ctr *container.Container) (setupErr error) {
    if len(ctr.ConfigReferences) == 0 {
        return nil
    }

Severity: Major
Found in daemon/container_operations_windows.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if hasMorePartial {
                            msg.PLogMetaData = &types.PartialLogMetaData{ID: partialid, Ordinal: ordinal, Last: true}
    
                            // reset
                            partialid = ""
    Severity: Major
    Found in daemon/logger/copier.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if msg.PLogMetaData == nil {
                              msg.Timestamp = time.Now().UTC()
                          } else {
                              msg.Timestamp = partialTS
                          }
      Severity: Major
      Found in daemon/logger/copier.go - About 45 mins to fix

        Function parseAddress has 7 return statements (exceeds 4 allowed).
        Open

        func parseAddress(address string) (string, string, error) {
            if address == "" {
                return "", "", nil
            }
            addr, err := url.Parse(address)
        Severity: Major
        Found in daemon/logger/syslog/syslog.go - About 45 mins to fix

          Function parseAddress has 7 return statements (exceeds 4 allowed).
          Open

          func parseAddress(address string) (*location, error) {
              if address == "" {
                  return &location{
                      protocol: defaultProtocol,
                      host:     defaultHost,
          Severity: Major
          Found in daemon/logger/fluentd/fluentd.go - About 45 mins to fix

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

            func (l *splunkLogger) postMessages(messages []*splunkMessage, lastChance bool) []*splunkMessage {
                messagesLen := len(messages)
            
                ctx, cancel := context.WithTimeout(context.Background(), batchSendTimeout)
                defer cancel()
            Severity: Minor
            Found in daemon/logger/splunk/splunk.go - About 45 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 reader.wait has 7 return statements (exceeds 4 allowed).
            Open

            func (r *reader) wait(ctx context.Context) (bool, error) {
                deadline := r.drainDeadline
                if d, ok := ctx.Deadline(); ok && d.Before(deadline) {
                    deadline = d
                }
            Severity: Major
            Found in daemon/logger/journald/read.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if err != io.EOF {
                                      logReadsFailedCount.Inc(1)
                                      log.G(context.TODO()).Errorf("Error scanning log stream: %s", err)
                                      return
                                  }
              Severity: Major
              Found in daemon/logger/copier.go - About 45 mins to fix

                Function getService has 7 return statements (exceeds 4 allowed).
                Open

                func getService(ctx context.Context, c swarmapi.ControlClient, input string, insertDefaults bool) (*swarmapi.Service, error) {
                    // GetService to match via full ID.
                    if rg, err := c.GetService(ctx, &swarmapi.GetServiceRequest{ServiceID: input, InsertDefaults: insertDefaults}); err == nil {
                        return rg.Service, nil
                    }
                Severity: Major
                Found in daemon/cluster/helpers.go - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      for ; n < l; n++ {
                                          if os.IsPathSeparator(path[n]) {
                                              break
                                          }
                                      }
                  Severity: Major
                  Found in daemon/logger/loggerutils/file_windows.go - About 45 mins to fix

                    Function ValidateLogOpt has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func ValidateLogOpt(cfg map[string]string) error {
                        for key := range cfg {
                            switch key {
                            case logGroupKey:
                            case logStreamKey:
                    Severity: Minor
                    Found in daemon/logger/awslogs/cloudwatchlogs.go - About 45 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

                    Avoid deeply nested control flow statements.
                    Open

                                        if logErr := c.dst.Log(msg); logErr != nil {
                                            logDriverError(c.dst.Name(), string(msg.Line), logErr)
                                        }
                    Severity: Major
                    Found in daemon/logger/copier.go - About 45 mins to fix

                      Method Daemon.initializeNetworkingPaths has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (daemon *Daemon) initializeNetworkingPaths(ctr *container.Container, nc *container.Container) error {
                          if nc.HostConfig.Isolation.IsHyperV() {
                              return fmt.Errorf("sharing of hyperv containers network is not supported")
                          }
                      
                      
                      Severity: Minor
                      Found in daemon/container_operations_windows.go - About 45 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

                      Avoid deeply nested control flow statements.
                      Open

                                          if logErr := c.dst.Log(msg); logErr != nil {
                                              logDriverError(c.dst.Name(), string(msg.Line), logErr)
                                          }
                      Severity: Major
                      Found in daemon/logger/copier.go - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if jsonEvent, err := json.Marshal(messages[j]); err != nil {
                                                log.G(ctx).Error(err)
                                            } else {
                                                log.G(ctx).Error(fmt.Errorf("Failed to send a message '%s'", string(jsonEvent)))
                                            }
                        Severity: Major
                        Found in daemon/logger/splunk/splunk.go - About 45 mins to fix

                          Function newStreamConfig has 7 return statements (exceeds 4 allowed).
                          Open

                          func newStreamConfig(info logger.Info) (*logStreamConfig, error) {
                              logGroupName := info.Config[logGroupKey]
                              logStreamName, err := loggerutils.ParseLogTag(info, "{{.FullID}}")
                              if err != nil {
                                  return nil, err
                          Severity: Major
                          Found in daemon/logger/awslogs/cloudwatchlogs.go - About 45 mins to fix

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

                            func New(info logger.Info) (logger.Logger, error) {
                                tag, err := loggerutils.ParseLogTag(info, loggerutils.DefaultTemplate)
                                if err != nil {
                                    return nil, err
                                }
                            Severity: Major
                            Found in daemon/logger/syslog/syslog.go - About 45 mins to fix

                              Method Daemon.containerStart has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func (daemon *Daemon) containerStart(ctx context.Context, daemonCfg *configStore, container *container.Container, checkpoint string, checkpointDir string, resetRestartManager bool) (retErr error) {
                              Severity: Minor
                              Found in daemon/start.go - About 45 mins to fix

                                Method reader.drainJournal has 7 return statements (exceeds 4 allowed).
                                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: Major
                                Found in daemon/logger/journald/read.go - About 45 mins to fix

                                  Method Daemon.newContainer has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func (daemon *Daemon) newContainer(name string, operatingSystem string, config *containertypes.Config, hostConfig *containertypes.HostConfig, imgID image.ID, managed bool) (*container.Container, error) {
                                  Severity: Minor
                                  Found in daemon/container.go - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language