dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

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/windows/windows_store.go and 1 other location - About 1 hr to fix
libnetwork/drivers/bridge/bridge_store.go on lines 28..48

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

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

func lookupUser(userStr, filepath string) (int, error) {
    // if the string is actually a uid integer, parse to int and return
    // as we don't need to translate with the help of files
    uid, err := strconv.Atoi(userStr)
    if err == nil {
Severity: Major
Found in builder/dockerfile/internals_linux.go and 1 other location - About 1 hr to fix
builder/dockerfile/internals_linux.go on lines 72..89

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

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

func lookupGroup(groupStr, filepath string) (int, error) {
    // if the string is actually a gid integer, parse to int and return
    // as we don't need to translate with the help of files
    gid, err := strconv.Atoi(groupStr)
    if err == nil {
Severity: Major
Found in builder/dockerfile/internals_linux.go and 1 other location - About 1 hr to fix
builder/dockerfile/internals_linux.go on lines 53..70

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

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

func (c *Controller) loadDriver(networkType string) error {
    var err error

    if pg := c.GetPluginGetter(); pg != nil {
        _, err = pg.Get(networkType, driverapi.NetworkPluginEndpointType, plugingetter.Lookup)
Severity: Major
Found in libnetwork/controller.go and 1 other location - About 1 hr to fix
libnetwork/controller.go on lines 1060..1077

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

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

func (c *Controller) loadIPAMDriver(name string) error {
    var err error

    if pg := c.GetPluginGetter(); pg != nil {
        _, err = pg.Get(name, ipamapi.PluginEndpointType, plugingetter.Lookup)
Severity: Major
Found in libnetwork/controller.go and 1 other location - About 1 hr to fix
libnetwork/controller.go on lines 1041..1058

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

Function newRepository has 62 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func newRepository(
    ctx context.Context, repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint,
    metaHeaders http.Header, authConfig *registrytypes.AuthConfig, actions ...string,
) (distribution.Repository, error) {
    repoName := repoInfo.Name.Name()
Severity: Minor
Found in distribution/registry.go - About 1 hr to fix

    Method Network.Services has 62 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (n *Network) Services() map[string]ServiceInfo {
        agent, ok := n.clusterAgent()
        if !ok {
            return nil
        }
    Severity: Minor
    Found in libnetwork/agent.go - About 1 hr to fix

      Method Controller.rmServiceBinding has 62 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (c *Controller) rmServiceBinding(svcName, svcID, nID, eID, containerName string, vip net.IP, ingressPorts []*PortConfig, serviceAliases []string, taskAliases []string, ip net.IP, method string, deleteSvcRecords bool, fullRemove bool) error {
          var rmService bool
      
          skey := serviceKey{
              id:    svcID,
      Severity: Minor
      Found in libnetwork/service_common.go - About 1 hr to fix

        Method driver.link has 62 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (d *driver) link(network *bridgeNetwork, endpoint *bridgeEndpoint, enable bool) (retErr error) {
            cc := endpoint.containerConfig
            ec := endpoint.extConnConfig
            if cc == nil || ec == nil || (len(cc.ParentEndpoints) == 0 && len(cc.ChildEndpoints) == 0) {
                // nothing to do
        Severity: Minor
        Found in libnetwork/drivers/bridge/bridge_linux.go - About 1 hr to fix

          Function monitor has 62 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func monitor(d *Daemon, c *container.Container, stop chan struct{}, probe probe) {
              probeInterval := timeoutWithDefault(c.Config.Healthcheck.Interval, defaultProbeInterval)
              startInterval := timeoutWithDefault(c.Config.Healthcheck.StartInterval, defaultStartInterval)
              startPeriod := timeoutWithDefault(c.Config.Healthcheck.StartPeriod, defaultStartPeriod)
          
          
          Severity: Minor
          Found in daemon/health.go - About 1 hr to fix

            Method Cluster.resolveSystemAddrViaSubnetCheck has 62 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (c *Cluster) resolveSystemAddrViaSubnetCheck() (net.IP, error) {
                // Use the system's only IP address, or fail if there are
                // multiple addresses to choose from. Skip interfaces which
                // are managed by docker via subnet check.
                interfaces, err := net.Interfaces()
            Severity: Minor
            Found in daemon/cluster/listen_addr.go - About 1 hr to fix

              Method ImageService.ImageInspect has 62 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (i *ImageService) ImageInspect(ctx context.Context, refOrID string, _ backend.ImageInspectOpts) (*imagetypes.InspectResponse, error) {
                  img, err := i.GetImage(ctx, refOrID, backend.GetImageOpts{})
                  if err != nil {
                      return nil, err
                  }
              Severity: Minor
              Found in daemon/images/image_inspect.go - About 1 hr to fix

                Function New has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func New(c testing.TB, name string, files map[string]string, enforceLocalServer bool) *FakeGit {
                    c.Helper()
                    ctx := fakecontext.New(c, "", fakecontext.WithFiles(files))
                    defer ctx.Close()
                    curdir, err := os.Getwd()
                Severity: Minor
                Found in testutil/fakegit/fakegit.go - About 1 hr to fix

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

                  func parseVlan(linkName string) (string, int, error) {
                      // parse -o parent=eth0.10
                      splitName := strings.Split(linkName, ".")
                      if len(splitName) != 2 {
                          return "", 0, fmt.Errorf("required interface name format is: name.vlan_id, ex. eth0.10 for vlan 10, instead received %s", linkName)
                  Severity: Major
                  Found in libnetwork/drivers/macvlan/macvlan_setup.go and 1 other location - About 1 hr to fix
                  libnetwork/drivers/ipvlan/ipvlan_setup.go on lines 161..179

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

                  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

                          for i := len(ips); i > 0; i-- {
                              node := <-doneCh
                              if node.result != expectedPeers {
                                  failed = true
                                  if retry == maxRetry-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 408..419

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

                  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

                          for i := len(ips); i > 0; i-- {
                              node := <-doneCh
                              if node.result != expectedPeers {
                                  failed = true
                                  if retry == maxRetry-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 347..358

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

                  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 parseVlan(linkName string) (string, int, error) {
                      // parse -o parent=eth0.10
                      splitName := strings.Split(linkName, ".")
                      if len(splitName) != 2 {
                          return "", 0, fmt.Errorf("required interface name format is: name.vlan_id, ex. eth0.10 for vlan 10, instead received %s", linkName)
                  Severity: Major
                  Found in libnetwork/drivers/ipvlan/ipvlan_setup.go and 1 other location - About 1 hr to fix
                  libnetwork/drivers/macvlan/macvlan_setup.go on lines 141..159

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

                  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

                      defer func() {
                          if retErr != nil {
                              if err := newProcess.Kill(); err != nil {
                                  logger.WithError(err).Error("failed to kill process")
                              }
                  Severity: Major
                  Found in libcontainerd/local/local_windows.go and 1 other location - About 1 hr to fix
                  libcontainerd/local/local_windows.go on lines 615..629

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

                  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

                      defer func() {
                          if retErr != nil {
                              if err := newProcess.Kill(); err != nil {
                                  logger.WithError(err).Error("failed to kill process")
                              }
                  Severity: Major
                  Found in libcontainerd/local/local_windows.go and 1 other location - About 1 hr to fix
                  libcontainerd/local/local_windows.go on lines 447..461

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

                  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 ResolvConf.Generate has 61 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (rc *ResolvConf) Generate(comments bool) ([]byte, error) {
                      s := struct {
                          Md          *metadata
                          NameServers []netip.Addr
                          Search      []string
                  Severity: Minor
                  Found in libnetwork/internal/resolvconf/resolvconf.go - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language