dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

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

func Register(r driverapi.Registerer, config map[string]interface{}) error {
    d := &driver{
        networks: networkTable{},
    }
    if err := d.initStore(config); err != nil {
Severity: Minor
Found in libnetwork/drivers/ipvlan/ipvlan.go and 1 other location - About 55 mins to fix
libnetwork/drivers/macvlan/macvlan.go on lines 60..71

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

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 Register(r driverapi.Registerer, config map[string]interface{}) error {
    d := &driver{
        networks: networkTable{},
    }
    if err := d.initStore(config); err != nil {
Severity: Minor
Found in libnetwork/drivers/macvlan/macvlan.go and 1 other location - About 55 mins to fix
libnetwork/drivers/ipvlan/ipvlan.go on lines 66..77

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

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 Manager.Upgrade has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

func (pm *Manager) Upgrade(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer) (err error) {
Severity: Major
Found in plugin/backend_linux.go - About 50 mins to fix

    Function New has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func New(ctx context.Context, rootDir string, cli *containerd.Client, ns string, exitHandler ExitHandler, shim string, shimOpts interface{}) (*Executor, error) {
    Severity: Major
    Found in plugin/executor/containerd/containerd.go - About 50 mins to fix

      Method Manager.Upgrade has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (pm *Manager) Upgrade(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer) error {
      Severity: Major
      Found in plugin/backend_unsupported.go - About 50 mins to fix

        Function ReplaceContainer has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func ReplaceContainer(ctx context.Context, client types.Client, id string, spec *specs.Spec, shim string, runtimeOptions interface{}, opts ...containerd.NewContainerOpts) (types.Container, error) {
        Severity: Major
        Found in libcontainerd/replace.go - About 50 mins to fix

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

          func (d *Daemon) ListServices(ctx context.Context, t testing.TB) []swarm.Service {
              t.Helper()
              cli := d.NewClientT(t)
              defer cli.Close()
          
          
          Severity: Minor
          Found in testutil/daemon/service.go and 1 other location - About 50 mins to fix
          testutil/daemon/node.go on lines 72..81

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

          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 spExists(sp *netlink.XfrmPolicy) (bool, error) {
              _, err := ns.NlHandle().XfrmPolicyGet(sp)
              switch err {
              case nil:
                  return true, nil
          Severity: Minor
          Found in libnetwork/drivers/overlay/encryption.go and 1 other location - About 50 mins to fix
          libnetwork/drivers/overlay/encryption.go on lines 430..442

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

          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 saExists(sa *netlink.XfrmState) (bool, error) {
              _, err := ns.NlHandle().XfrmStateGet(sa)
              switch err {
              case nil:
                  return true, nil
          Severity: Minor
          Found in libnetwork/drivers/overlay/encryption.go and 1 other location - About 50 mins to fix
          libnetwork/drivers/overlay/encryption.go on lines 444..456

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

          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 (d *Daemon) ListNodes(ctx context.Context, t testing.TB) []swarm.Node {
              t.Helper()
              cli := d.NewClientT(t)
              defer cli.Close()
          
          
          Severity: Minor
          Found in testutil/daemon/node.go and 1 other location - About 50 mins to fix
          testutil/daemon/service.go on lines 100..108

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

          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 Executor.Restore has 8 return statements (exceeds 4 allowed).
          Open

          func (e *Executor) Restore(id string, stdout, stderr io.WriteCloser) (bool, error) {
              ctx := context.Background()
              p := c8dPlugin{log: log.G(ctx).WithField("plugin", id)}
              ctr, err := e.client.LoadContainer(ctx, id)
              if err != nil {
          Severity: Major
          Found in plugin/executor/containerd/containerd.go - About 50 mins to fix

            Method store.Create has 8 return statements (exceeds 4 allowed).
            Open

            func (is *store) Create(config []byte) (ID, error) {
                var img *Image
                img, err := NewFromJSON(config)
                if err != nil {
                    return "", err
            Severity: Major
            Found in image/store.go - About 50 mins to fix

              Method pushDescriptor.Upload has 8 return statements (exceeds 4 allowed).
              Open

              func (pd *pushDescriptor) Upload(ctx context.Context, progressOutput progress.Output) (distribution.Descriptor, error) {
                  // Skip foreign layers unless this registry allows nondistributable artifacts.
                  if !pd.endpoint.AllowNondistributableArtifacts {
                      if fs, ok := pd.layer.(distribution.Describable); ok {
                          if d := fs.Descriptor(); len(d.URLs) > 0 {
              Severity: Major
              Found in distribution/push_v2.go - About 50 mins to fix

                Function setupSeccomp has 8 return statements (exceeds 4 allowed).
                Open

                func setupSeccomp(config *Seccomp, rs *specs.Spec) (*specs.LinuxSeccomp, error) {
                    if config == nil {
                        return nil, nil
                    }
                
                
                Severity: Major
                Found in profiles/seccomp/seccomp_linux.go - About 50 mins to fix

                  Method Store.Get has 8 return statements (exceeds 4 allowed).
                  Open

                  func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlugin, error) {
                      // Lookup using new model.
                      if ps != nil {
                          p, err := ps.GetV2Plugin(name)
                          if err == nil {
                  Severity: Major
                  Found in plugin/store.go - About 50 mins to fix

                    Function calcSize has 8 return statements (exceeds 4 allowed).
                    Open

                    func calcSize(ctx context.Context, dir string) (int64, error) {
                        var size int64
                        data := make(map[uint64]struct{})
                        err := filepath.Walk(dir, func(d string, fileInfo os.FileInfo, err error) error {
                            if err != nil {
                    Severity: Major
                    Found in internal/directory/directory_unix.go - About 50 mins to fix

                      Method store.restore has 8 return statements (exceeds 4 allowed).
                      Open

                      func (is *store) restore() error {
                          // As the code below is run when restoring all images (which can be "many"),
                          // constructing the "log.G(ctx).WithFields" is deliberately not "DRY", as the
                          // logger is only used for error-cases, and we don't want to do allocations
                          // if we don't need it. The "f" type alias is here is just for convenience,
                      Severity: Major
                      Found in image/store.go - About 50 mins to fix

                        Method Manager.Upgrade has 8 return statements (exceeds 4 allowed).
                        Open

                        func (pm *Manager) Upgrade(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer) (err error) {
                            p, err := pm.config.Store.GetV2Plugin(name)
                            if err != nil {
                                return err
                            }
                        Severity: Major
                        Found in plugin/backend_linux.go - About 50 mins to fix

                          Method ImageCache.GetCache has 8 return statements (exceeds 4 allowed).
                          Open

                          func (ic *ImageCache) GetCache(parentID string, cfg *containertypes.Config, platform ocispec.Platform) (string, error) {
                              imgID, err := ic.localImageCache.GetCache(parentID, cfg, platform)
                              if err != nil {
                                  return "", err
                              }
                          Severity: Major
                          Found in image/cache/cache.go - About 50 mins to fix

                            Method Sandbox.populateNetworkResources has 8 return statements (exceeds 4 allowed).
                            Open

                            func (sb *Sandbox) populateNetworkResources(ctx context.Context, ep *Endpoint) error {
                                ctx, span := otel.Tracer("").Start(ctx, "libnetwork.Sandbox.populateNetworkResources", trace.WithAttributes(
                                    attribute.String("endpoint.Name", ep.Name())))
                                defer span.End()
                            
                            
                            Severity: Major
                            Found in libnetwork/sandbox_linux.go - About 50 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language