dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method Plugin.Set has 63 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (p *Plugin) Set(args []string) error {
    p.mu.Lock()
    defer p.mu.Unlock()

    if p.PluginObj.Enabled {
Severity: Minor
Found in plugin/v2/plugin.go - About 1 hr to fix

    Function newProxy has 63 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func newProxy(config ProxyConfig) (p Proxy, err error) {
        ipv := ipv4
        if config.HostIP.To4() == nil {
            ipv = ipv6
        }
    Severity: Minor
    Found in cmd/docker-proxy/main_linux.go - About 1 hr to fix

      Method Daemon.ContainerAttach has 63 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (daemon *Daemon) ContainerAttach(prefixOrName string, req *backend.ContainerAttachConfig) error {
          keys := []byte{}
          var err error
          if req.DetachKeys != "" {
              keys, err = term.ToBytes(req.DetachKeys)
      Severity: Minor
      Found in daemon/attach.go - About 1 hr to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        func IsNetworkNotAvailable(ctx context.Context, c client.NetworkAPIClient, name string) cmp.Comparison {
            return func() cmp.Result {
                networks, err := c.NetworkList(ctx, network.ListOptions{})
                if err != nil {
                    return cmp.ResultFromError(err)
        Severity: Major
        Found in integration/network/helpers_windows.go and 1 other location - About 1 hr to fix
        integration/network/helpers.go on lines 71..84

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 161.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        func IsNetworkAvailable(ctx context.Context, c client.NetworkAPIClient, name string) cmp.Comparison {
            return func() cmp.Result {
                networks, err := c.NetworkList(ctx, network.ListOptions{})
                if err != nil {
                    return cmp.ResultFromError(err)
        Severity: Major
        Found in integration/network/helpers_windows.go and 1 other location - About 1 hr to fix
        integration/network/helpers.go on lines 55..68

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 161.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        func IsNetworkAvailable(ctx context.Context, c client.NetworkAPIClient, name string) cmp.Comparison {
            return func() cmp.Result {
                networks, err := c.NetworkList(ctx, network.ListOptions{})
                if err != nil {
                    return cmp.ResultFromError(err)
        Severity: Major
        Found in integration/network/helpers.go and 1 other location - About 1 hr to fix
        integration/network/helpers_windows.go on lines 13..26

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 161.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        func IsNetworkNotAvailable(ctx context.Context, c client.NetworkAPIClient, name string) cmp.Comparison {
            return func() cmp.Result {
                networks, err := c.NetworkList(ctx, network.ListOptions{})
                if err != nil {
                    return cmp.ResultFromError(err)
        Severity: Major
        Found in integration/network/helpers.go and 1 other location - About 1 hr to fix
        integration/network/helpers_windows.go on lines 29..42

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 161.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if errors.As(err, &apiErr) {
                    fields := log.Fields{
                        "errorCode":     apiErr.ErrorCode(),
                        "message":       apiErr.ErrorMessage(),
                        "logGroupName":  l.logGroupName,
        Severity: Major
        Found in daemon/logger/awslogs/cloudwatchlogs.go and 1 other location - About 1 hr to fix
        daemon/logger/awslogs/cloudwatchlogs.go on lines 477..490

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 161.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if errors.As(err, &apiErr) {
                    fields := log.Fields{
                        "errorCode":      apiErr.ErrorCode(),
                        "message":        apiErr.ErrorMessage(),
                        "logGroupName":   l.logGroupName,
        Severity: Major
        Found in daemon/logger/awslogs/cloudwatchlogs.go and 1 other location - About 1 hr to fix
        daemon/logger/awslogs/cloudwatchlogs.go on lines 516..529

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 161.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method CompoundMessage.Unmarshal has 16 return statements (exceeds 4 allowed).
        Open

        func (m *CompoundMessage) 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 driver.CreateEndpoint has 16 return statements (exceeds 4 allowed).
          Open

          func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
              var err error
              if err = validateID(nid, eid); err != nil {
                  return err
              }
          Severity: Major
          Found in libnetwork/drivers/windows/overlay/ov_endpoint_windows.go - About 1 hr to fix

            Method containerRouter.postContainersCreate has 16 return statements (exceeds 4 allowed).
            Open

            func (s *containerRouter) postContainersCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                if err := httputils.ParseForm(r); err != nil {
                    return err
                }
                if err := httputils.CheckForJSON(r); err != nil {
            Severity: Major
            Found in api/server/router/container/container_routes.go - About 1 hr to fix

              Method ImageService.ImageDelete has 16 return statements (exceeds 4 allowed).
              Open

              func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) (response []imagetypes.DeleteResponse, retErr error) {
                  start := time.Now()
                  defer func() {
                      if retErr == nil {
                          dimages.ImageActions.WithValues("delete").UpdateSince(start)
              Severity: Major
              Found in daemon/containerd/image_delete.go - About 1 hr to fix

                Method Cluster.Init has 16 return statements (exceeds 4 allowed).
                Open

                func (c *Cluster) Init(req types.InitRequest) (string, error) {
                    c.controlMutex.Lock()
                    defer c.controlMutex.Unlock()
                    if c.nr != nil {
                        if req.ForceNewCluster {
                Severity: Major
                Found in daemon/cluster/swarm.go - About 1 hr to fix

                  Method Daemon.connectToNetwork has 16 return statements (exceeds 4 allowed).
                  Open

                  func (daemon *Daemon) connectToNetwork(ctx context.Context, cfg *config.Config, ctr *container.Container, idOrName string, endpointConfig *network.EndpointSettings, updateSettings bool) (retErr error) {
                      containerName := strings.TrimPrefix(ctr.Name, "/")
                      ctx, span := otel.Tracer("").Start(ctx, "daemon.connectToNetwork", trace.WithAttributes(
                          attribute.String("container.ID", ctr.ID),
                          attribute.String("container.name", containerName),
                  Severity: Major
                  Found in daemon/container_operations.go - About 1 hr to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    func networkPeersNumber(ip, port, networkName string, doneCh chan resultTuple) {
                        body, err := httpGet(ip, port, "/networkpeers?nid="+networkName)
                        if err != nil {
                            log.G(context.TODO()).Errorf("networkPeersNumber %s there was an error: %s", ip, err)
                            doneCh <- resultTuple{id: ip, result: -1}
                    Severity: Major
                    Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go and 1 other location - About 1 hr to fix
                    libnetwork/cmd/networkdb-test/dbclient/ndbClient.go on lines 117..127

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 160.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    func dbQueueLength(ip, port, networkName string, doneCh chan resultTuple) {
                        body, err := httpGet(ip, port, "/networkstats?nid="+networkName)
                        if err != nil {
                            log.G(context.TODO()).Errorf("queueLength %s there was an error: %s", ip, err)
                            doneCh <- resultTuple{id: ip, result: -1}
                    Severity: Major
                    Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go and 1 other location - About 1 hr to fix
                    libnetwork/cmd/networkdb-test/dbclient/ndbClient.go on lines 92..103

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 160.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        if !n.config.Internal {
                            if len(n.config.Ipv4Subnets) > 0 {
                                s := n.getSubnetforIPv4(ep.addr)
                                if s == nil {
                                    return fmt.Errorf("could not find a valid ipv4 subnet for endpoint %s", eid)
                    Severity: Major
                    Found in libnetwork/drivers/macvlan/macvlan_joinleave.go and 1 other location - About 1 hr to fix
                    libnetwork/drivers/ipvlan/ipvlan_joinleave.go on lines 63..144

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 160.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        if !n.config.Internal {
                            switch n.config.IpvlanMode {
                            case modeL3, modeL3S:
                                // disable gateway services to add a default gw using dev eth0 only
                                jinfo.DisableGatewayService()
                    Severity: Major
                    Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go and 1 other location - About 1 hr to fix
                    libnetwork/drivers/macvlan/macvlan_joinleave.go on lines 52..103

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 160.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                    func (d *driver) initStore(option map[string]interface{}) error {
                        if data, ok := option[netlabel.LocalKVClient]; ok {
                            var ok bool
                            d.store, ok = data.(*datastore.Store)
                            if !ok {
                    Severity: Major
                    Found in libnetwork/drivers/bridge/bridge_store.go and 1 other location - About 1 hr to fix
                    libnetwork/drivers/windows/windows_store.go on lines 22..42

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 159.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language