dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method containerRouter.postContainersAttach has 56 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    Function adjustForAPIVersion has 56 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func adjustForAPIVersion(cliVersion string, service *swarm.ServiceSpec) {
        if cliVersion == "" {
            return
        }
        if versions.LessThan(cliVersion, "1.46") {
    Severity: Minor
    Found in api/server/router/swarm/helpers.go - About 1 hr to fix

      Method Cluster.Leave has 56 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (c *Cluster) Leave(ctx context.Context, force bool) error {
          c.controlMutex.Lock()
          defer c.controlMutex.Unlock()
      
          c.mu.Lock()
      Severity: Minor
      Found in daemon/cluster/swarm.go - About 1 hr to fix

        Function validateEndpointSettings has 56 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func validateEndpointSettings(nw *libnetwork.Network, nwName string, epConfig *networktypes.EndpointSettings) error {
            if epConfig == nil {
                return nil
            }
        
        
        Severity: Minor
        Found in daemon/container_operations.go - About 1 hr to fix

          Method Client.callWithRetry has 56 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (c *Client) callWithRetry(serviceMethod string, data io.Reader, retry bool, reqOpts ...func(*RequestOpts)) (io.ReadCloser, error) {
              var retries int
              start := time.Now()
          
              var opts RequestOpts
          Severity: Minor
          Found in pkg/plugins/client.go - About 1 hr to fix

            Method Daemon.CreateImageFromContainer has 56 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (daemon *Daemon) CreateImageFromContainer(ctx context.Context, name string, c *backend.CreateImageConfig) (string, error) {
                start := time.Now()
            
                container, err := daemon.GetContainer(name)
                if err != nil {
            Severity: Minor
            Found in daemon/commit.go - About 1 hr to fix

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

                  case mount.TypeVolume:
                      if cfg.Source == "" {
                          mp.Name = stringid.GenerateRandomID()
                      } else {
                          mp.Name = cfg.Source
              Severity: Major
              Found in volume/mounts/linux_parser.go and 1 other location - About 1 hr to fix
              volume/mounts/windows_parser.go on lines 395..410

              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 144.

              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

                  case mount.TypeVolume:
                      if cfg.Source == "" {
                          mp.Name = stringid.GenerateRandomID()
                      } else {
                          mp.Name = cfg.Source
              Severity: Major
              Found in volume/mounts/windows_parser.go and 1 other location - About 1 hr to fix
              volume/mounts/linux_parser.go on lines 331..346

              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 144.

              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 parseNetworkGenericOptions(data interface{}) (*configuration, error) {
                  switch opt := data.(type) {
                  case *configuration:
                      return opt, nil
                  case map[string]string:
              Severity: Major
              Found in libnetwork/drivers/ipvlan/ipvlan_network.go and 1 other location - About 1 hr to fix
              libnetwork/drivers/macvlan/macvlan_network.go on lines 233..249

              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 144.

              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 parseNetworkGenericOptions(data interface{}) (*configuration, error) {
                  switch opt := data.(type) {
                  case *configuration:
                      return opt, nil
                  case map[string]string:
              Severity: Major
              Found in libnetwork/drivers/macvlan/macvlan_network.go and 1 other location - About 1 hr to fix
              libnetwork/drivers/ipvlan/ipvlan_network.go on lines 224..240

              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 144.

              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

                          selectLoop:
                              for {
                                  progress.Updatef(progressOutput, descriptor.ID(), "Retrying in %d second%s", delay, (map[bool]string{true: "s"})[delay != 1])
                                  select {
                                  case <-ticker.C:
              Severity: Major
              Found in distribution/xfer/upload.go and 1 other location - About 1 hr to fix
              distribution/xfer/download.go on lines 300..315

              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 143.

              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

                          selectLoop:
                              for {
                                  progress.Updatef(progressOutput, descriptor.ID(), "Retrying in %d second%s", delay, (map[bool]string{true: "s"})[delay != 1])
                                  select {
                                  case <-ticker.C:
              Severity: Major
              Found in distribution/xfer/download.go and 1 other location - About 1 hr to fix
              distribution/xfer/upload.go on lines 153..168

              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 143.

              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

              Function computePrivileges has 55 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func computePrivileges(c types.PluginConfig) types.PluginPrivileges {
                  var privileges types.PluginPrivileges
                  if c.Network.Type != "null" && c.Network.Type != "bridge" && c.Network.Type != "" {
                      privileges = append(privileges, types.PluginPrivilege{
                          Name:        "network",
              Severity: Minor
              Found in plugin/backend_linux.go - About 1 hr to fix

                Method NetworkDB.handleTableEvent has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent, isBulkSync bool) bool {
                    // Update our local clock if the received messages has newer time.
                    nDB.tableClock.Witness(tEvent.LTime)
                
                    // Ignore the table events for networks that are in the process of going away
                Severity: Minor
                Found in libnetwork/networkdb/delegate.go - About 1 hr to fix

                  Method PortAllocator.RequestPortsInRange has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (p *PortAllocator) RequestPortsInRange(ips []net.IP, proto string, portStart, portEnd int) (int, error) {
                      if proto != "tcp" && proto != "udp" && proto != "sctp" {
                          return 0, ErrUnknownProtocol
                      }
                  
                  
                  Severity: Minor
                  Found in libnetwork/portallocator/portallocator.go - About 1 hr to fix

                    Method TableEvent.MarshalToSizedBuffer has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (m *TableEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                        i := len(dAtA)
                        _ = i
                        var l int
                        _ = l
                    Severity: Minor
                    Found in libnetwork/networkdb/networkdb.pb.go - About 1 hr to fix

                      Method driver.CreateEndpoint has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) (retErr error) {
                          if ifInfo == nil {
                              return errors.New("must not be called with nil InterfaceInfo")
                          }
                      
                      
                      Severity: Minor
                      Found in libnetwork/drivers/remote/driver.go - About 1 hr to fix

                        Function programSA has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (fSA *netlink.XfrmState, rSA *netlink.XfrmState, err error) {
                            var (
                                action      = "Removing"
                                xfrmProgram = ns.NlHandle().XfrmStateDel
                            )
                        Severity: Minor
                        Found in libnetwork/drivers/overlay/encryption.go - About 1 hr to fix

                          Method linuxParser.ParseMountRaw has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (p *linuxParser) ParseMountRaw(raw, volumeDriver string) (*MountPoint, error) {
                              arr := strings.SplitN(raw, ":", 4)
                              if arr[0] == "" {
                                  return nil, errInvalidSpec(raw)
                              }
                          Severity: Minor
                          Found in volume/mounts/linux_parser.go - About 1 hr to fix

                            Method containerRouter.wsContainersAttach has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

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