dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

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

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

    func (daemon *Daemon) registerName(container *container.Container) error {
        if container.ID == "" {
            return fmt.Errorf("invalid empty id")
        }
        if daemon.containers.Get(container.ID) != nil {
    Severity: Major
    Found in daemon/names.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 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

          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.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 parseAddress has 5 return statements (exceeds 4 allowed).
              Open

              func parseAddress(address string) (*url.URL, error) {
                  if address == "" {
                      return nil, fmt.Errorf("gelf-address is a required parameter")
                  }
                  addr, err := url.Parse(address)
              Severity: Major
              Found in daemon/logger/gelf/gelf.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

                  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 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()).WithFields(log.Fields{
                          "signal":    int(stopSignal),
                          "container": container.ID,
                      }).Debugf("sending signal %[1]d (%[1]s) to container", stopSignal)
                  Severity: Major
                  Found in daemon/kill.go - About 35 mins to fix

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

                    func NodeFromGRPC(n swarmapi.Node) types.Node {
                        node := types.Node{
                            ID: n.ID,
                            Spec: types.NodeSpec{
                                Role:         types.NodeRole(strings.ToLower(n.Spec.DesiredRole.String())),
                    Severity: Minor
                    Found in daemon/cluster/convert/node.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 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

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

                    func New(info logger.Info) (logger.Logger, error) {
                        fluentConfig, err := parseConfig(info.Config)
                        if err != nil {
                            return nil, errdefs.InvalidParameter(err)
                        }
                    Severity: Major
                    Found in daemon/logger/fluentd/fluentd.go - About 35 mins to fix

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

                      func containerToGRPC(c *types.ContainerSpec) (*swarmapi.ContainerSpec, error) {
                          containerSpec := &swarmapi.ContainerSpec{
                              Image:          c.Image,
                              Labels:         c.Labels,
                              Command:        c.Command,
                      Severity: Major
                      Found in daemon/cluster/convert/container.go - About 35 mins to fix

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

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

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

                          func (daemon *Daemon) ContainerKill(name, stopSignal string) error {
                              var (
                                  err error
                                  sig = syscall.SIGKILL
                              )
                          Severity: Major
                          Found in daemon/kill.go - About 35 mins to fix

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

                            func getUntilFromPruneFilters(pruneFilters filters.Args) (time.Time, error) {
                                until := time.Time{}
                                if !pruneFilters.Contains("until") {
                                    return until, nil
                                }
                            Severity: Major
                            Found in daemon/prune.go - About 35 mins to fix

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

                              func (daemon *Daemon) updateNetworkSettings(ctr *container.Container, n *libnetwork.Network, endpointConfig *networktypes.EndpointSettings) error {
                                  if ctr.NetworkSettings == nil {
                                      ctr.NetworkSettings = &network.Settings{}
                                  }
                                  if ctr.NetworkSettings.Networks == nil {
                              Severity: Major
                              Found in daemon/container_operations.go - About 35 mins to fix

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

                                func makePluginAdapter(p plugingetter.CompatPlugin) (metricsPlugin, error) {
                                    if pc, ok := p.(plugingetter.PluginWithV1Client); ok {
                                        return &metricsPluginAdapter{pc.Client(), p.Name()}, nil
                                    }
                                
                                
                                Severity: Major
                                Found in daemon/metrics.go - About 35 mins to fix

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

                                  func copyRegular(srcPath, dstPath string, fileinfo os.FileInfo, copyWithFileRange, copyWithFileClone *bool) error {
                                      srcFile, err := os.Open(srcPath)
                                      if err != nil {
                                          return err
                                      }
                                  Severity: Major
                                  Found in daemon/graphdriver/copy/copy.go - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language