dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

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

func New(info logger.Info) (logger.Logger, error) {
    // parse gelf address
    address, err := parseAddress(info.Config["gelf-address"])
    if err != nil {
        return nil, err
Severity: Major
Found in daemon/logger/gelf/gelf.go - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

        if !splunkURL.IsAbs() ||
            (splunkURL.Scheme != "http" && splunkURL.Scheme != "https") ||
            (splunkURL.Path != "" && splunkURL.Path != "/") ||
            splunkURL.RawQuery != "" ||
            splunkURL.Fragment != "" {
    Severity: Major
    Found in daemon/logger/splunk/splunk.go - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

          if path[1] == ':' &&
              ('0' <= c && c <= '9' || 'a' <= c && c <= 'z' ||
                  'A' <= c && c <= 'Z') {
      Severity: Major
      Found in daemon/logger/loggerutils/file_windows.go - About 1 hr to fix

        Function validateHostConfig has 10 return statements (exceeds 4 allowed).
        Open

        func validateHostConfig(hostConfig *containertypes.HostConfig) error {
            if hostConfig == nil {
                return nil
            }
        
        
        Severity: Major
        Found in daemon/container.go - About 1 hr to fix

          Method Daemon.containerExtractToDir has 10 return statements (exceeds 4 allowed).
          Open

          func (daemon *Daemon) containerExtractToDir(container *container.Container, path string, copyUIDGID, noOverwriteDirNonDir bool, content io.Reader) (err error) {
              container.Lock()
              defer container.Unlock()
          
              cfs, err := daemon.openContainerFS(container)
          Severity: Major
          Found in daemon/archive_unix.go - About 1 hr to fix

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

            func New(name string, config Options) (Driver, error) {
                ctx := context.TODO()
                if name != "" {
                    log.G(ctx).Infof("[graphdriver] trying configured driver: %s", name)
                    if err := checkRemoved(name); err != nil {
            Severity: Major
            Found in daemon/graphdriver/driver.go - About 1 hr to fix

              Method Daemon.createNetwork has 10 return statements (exceeds 4 allowed).
              Open

              func (daemon *Daemon) createNetwork(cfg *config.Config, create networktypes.CreateRequest, id string, agent bool) (*networktypes.CreateResponse, error) {
                  if network.IsPredefined(create.Name) {
                      return nil, PredefinedNetworkError(create.Name)
                  }
              
              
              Severity: Major
              Found in daemon/network.go - About 1 hr to fix

                Method ImageService.GetImageAndReleasableLayer has 10 return statements (exceeds 4 allowed).
                Open

                func (i *ImageService) GetImageAndReleasableLayer(ctx context.Context, refOrID string, opts backend.GetImageAndLayerOptions) (builder.Image, builder.ROLayer, error) {
                    if refOrID == "" { // FROM scratch
                        if runtime.GOOS == "windows" {
                            return nil, nil, fmt.Errorf(`"FROM scratch" is not supported on Windows`)
                        }
                Severity: Major
                Found in daemon/images/image_builder.go - About 1 hr to fix

                  Function changes has 10 return statements (exceeds 4 allowed).
                  Open

                  func changes(layers []string, rw string, dc deleteChange, sc skipChange) ([]Change, error) {
                      var (
                          changes     []Change
                          changedDirs = make(map[string]struct{})
                      )
                  Severity: Major
                  Found in pkg/archive/changes.go - About 1 hr to fix

                    Function Validate has 10 return statements (exceeds 4 allowed).
                    Open

                    func Validate(config *Config) error {
                        // validate log-level
                        if config.LogLevel != "" {
                            // FIXME(thaJeztah): find a better way for this; this depends on knowledge of containerd's log package internals.
                            // Alternatively: try  log.SetLevel(config.LogLevel), and restore the original level, but this also requires internal knowledge.
                    Severity: Major
                    Found in daemon/config/config.go - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                          if oldStat.Mode() != newStat.Mode() ||
                              oldStat.UID() != newStat.UID() ||
                              oldStat.GID() != newStat.GID() ||
                              oldStat.Rdev() != newStat.Rdev() ||
                              // Don't look at size or modification time for dirs, its not a good
                      Severity: Major
                      Found in pkg/archive/changes_unix.go - About 1 hr to fix

                        Method Manager.List has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (pm *Manager) List(pluginFilters filters.Args) ([]types.Plugin, error) {
                            if err := pluginFilters.Validate(acceptedPluginFilterTags); err != nil {
                                return nil, err
                            }
                        
                        
                        Severity: Minor
                        Found in plugin/backend_linux.go - About 55 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 Manager.Privileges has 9 return statements (exceeds 4 allowed).
                        Open

                        func (pm *Manager) Privileges(ctx context.Context, ref reference.Named, metaHeader http.Header, authConfig *registry.AuthConfig) (types.PluginPrivileges, error) {
                            var (
                                config     types.PluginConfig
                                configSeen bool
                            )
                        Severity: Major
                        Found in plugin/backend_linux.go - About 55 mins to fix

                          Function SwitchRoot has 9 return statements (exceeds 4 allowed).
                          Open

                          func SwitchRoot(path string) error {
                              if mounted, _ := mountinfo.Mounted(path); !mounted {
                                  if err := mount.Mount(path, path, "bind", "rbind,rw"); err != nil {
                                      return realChroot(path)
                                  }
                          Severity: Major
                          Found in internal/mounttree/switchroot_linux.go - About 55 mins to fix

                            Method Controller.NewSandbox has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (c *Controller) NewSandbox(ctx context.Context, containerID string, options ...SandboxOption) (_ *Sandbox, retErr error) {
                                if containerID == "" {
                                    return nil, types.InvalidParameterErrorf("invalid container ID")
                                }
                            
                            
                            Severity: Minor
                            Found in libnetwork/controller.go - About 55 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 fetchTable has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func fetchTable(ip string, port int, network, tableName string, clusterPeers, networkPeers map[string]string, remediate bool) {
                                log.G(context.TODO()).Infof("Fetch %s table and check owners", tableName)
                                resp, err := http.Get(fmt.Sprintf(dumpTable, ip, port, network, tableName))
                                if err != nil {
                                    log.G(context.TODO()).WithError(err).Fatalf("Failed fetching endpoint table")
                            Severity: Minor
                            Found in libnetwork/cmd/diagnostic/main.go - About 55 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 Controller.cleanupLocalEndpoints has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (c *Controller) cleanupLocalEndpoints() error {
                                // Get used endpoints
                                eps := make(map[string]interface{})
                                for _, sb := range c.sandboxes {
                                    for _, ep := range sb.endpoints {
                            Severity: Minor
                            Found in libnetwork/endpoint.go - About 55 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 checkTable has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func checkTable(ctx context.Context, ips []string, port, networkName, tableName string, expectedEntries int, fn func(string, string, string, string, chan resultTuple)) (opTime time.Duration) {
                                startTime := time.Now().UnixNano()
                                var successTime int64
                            
                                // Loop for 2 minutes to guarantee that the result is stable
                            Severity: Minor
                            Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go - About 55 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 driver.Join has 9 return statements (exceeds 4 allowed).
                            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: Major
                            Found in libnetwork/drivers/remote/driver.go - About 55 mins to fix

                              Function StartProxy has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                              Open

                              func StartProxy(pb types.PortBinding,
                                  proxyPath string,
                                  listenSock *os.File,
                              ) (stop func() error, retErr error) {
                                  if proxyPath == "" {
                              Severity: Minor
                              Found in libnetwork/portmapper/proxy_linux.go - About 55 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

                              Severity
                              Category
                              Status
                              Source
                              Language