dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Function newStreamConfig has 51 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func newStreamConfig(info logger.Info) (*logStreamConfig, error) {
    logGroupName := info.Config[logGroupKey]
    logStreamName, err := loggerutils.ParseLogTag(info, "{{.FullID}}")
    if err != nil {
        return nil, err
Severity: Minor
Found in daemon/logger/awslogs/cloudwatchlogs.go - About 1 hr to fix

    Function serviceSpecFromGRPC has 51 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func serviceSpecFromGRPC(spec *swarmapi.ServiceSpec) (*types.ServiceSpec, error) {
        if spec == nil {
            return nil, nil
        }
    
    
    Severity: Minor
    Found in daemon/cluster/convert/service.go - About 1 hr to fix

      Method LocalRegistry.Scan has 51 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (l *LocalRegistry) Scan() ([]string, error) {
          var names []string
          dirEntries, err := os.ReadDir(l.socketsPath)
          if err != nil && !os.IsNotExist(err) {
              return nil, errors.Wrap(err, "error reading dir entries")
      Severity: Minor
      Found in pkg/plugins/discovery.go - About 1 hr to fix

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

        func (n *Namespace) UnsetGateway() error {
            gw := n.Gateway()
            if len(gw) == 0 {
                return nil
            }
        Severity: Major
        Found in libnetwork/osl/route_linux.go and 1 other location - About 1 hr to fix
        libnetwork/osl/route_linux.go on lines 158..172

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

        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

            case NodeEventTypeJoin:
                moved, err := nDB.changeNodeState(n.Name, nodeActiveState)
                if err != nil {
                    log.G(context.TODO()).WithError(err).Error("unable to find the node to move")
                    return false
        Severity: Major
        Found in libnetwork/networkdb/delegate.go and 1 other location - About 1 hr to fix
        libnetwork/networkdb/delegate.go on lines 60..69

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

        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 (n *Namespace) UnsetGatewayIPv6() error {
            gwv6 := n.GatewayIPv6()
            if len(gwv6) == 0 {
                return nil
            }
        Severity: Major
        Found in libnetwork/osl/route_linux.go and 1 other location - About 1 hr to fix
        libnetwork/osl/route_linux.go on lines 61..74

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

        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

            case NodeEventTypeLeave:
                moved, err := nDB.changeNodeState(n.Name, nodeLeftState)
                if err != nil {
                    log.G(context.TODO()).WithError(err).Error("unable to find the node to move")
                    return false
        Severity: Major
        Found in libnetwork/networkdb/delegate.go and 1 other location - About 1 hr to fix
        libnetwork/networkdb/delegate.go on lines 50..59

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

        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 puller.pullManifestList has 10 return statements (exceeds 4 allowed).
        Open

        func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfstList *manifestlist.DeserializedManifestList, pp *ocispec.Platform) (id digest.Digest, manifestListDigest digest.Digest, err error) {
            manifestListDigest, err = schema2ManifestDigest(ref, mfstList)
            if err != nil {
                return "", "", err
            }
        Severity: Major
        Found in distribution/pull_v2.go - About 1 hr to fix

          Method puller.pullSchema1 has 10 return statements (exceeds 4 allowed).
          Open

          func (p *puller) pullSchema1(ctx context.Context, ref reference.Reference, unverifiedManifest *schema1.SignedManifest, platform *ocispec.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
              if platform != nil {
                  // Early bath if the requested OS doesn't match that of the configuration.
                  // This avoids doing the download, only to potentially fail later.
                  if err := image.CheckOS(platform.OS); err != nil {
          Severity: Major
          Found in distribution/pull_v2.go - About 1 hr to fix

            Method Manager.Pull has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

              Method Manager.Pull has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

                Method tarexporter.legacyLoad has 10 return statements (exceeds 4 allowed).
                Open

                func (l *tarexporter) legacyLoad(tmpDir string, outStream io.Writer, progressOutput progress.Output) error {
                    if runtime.GOOS == "windows" {
                        return errors.New("Windows does not support legacy loading of images")
                    }
                
                
                Severity: Major
                Found in image/tarexport/load.go - About 1 hr to fix

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

                  func Join(ctx context.Context, path, subpath string) (*SafePath, error) {
                      base, subpart, err := evaluatePath(path, subpath)
                      if err != nil {
                          return nil, err
                      }
                  Severity: Major
                  Found in internal/safepath/join_windows.go - About 1 hr to fix

                    Method Resolver.setupIPTable has 10 return statements (exceeds 4 allowed).
                    Open

                    func (r *Resolver) setupIPTable() error {
                        if r.err != nil {
                            return r.err
                        }
                        laddr := r.conn.LocalAddr().String()
                    Severity: Major
                    Found in libnetwork/resolver_unix.go - About 1 hr to fix

                      Method addrSpace.allocatePredefinedPool has 10 return statements (exceeds 4 allowed).
                      Open

                      func (aSpace *addrSpace) allocatePredefinedPool(reserved []netip.Prefix) (netip.Prefix, error) {
                          aSpace.mu.Lock()
                          defer aSpace.mu.Unlock()
                      
                          var pdfID int
                      Severity: Major
                      Found in libnetwork/ipams/defaultipam/address_space.go - About 1 hr to fix

                        Method Endpoint.sbLeave has 10 return statements (exceeds 4 allowed).
                        Open

                        func (ep *Endpoint) sbLeave(ctx context.Context, sb *Sandbox, force bool) error {
                            n, err := ep.getNetworkFromStore()
                            if err != nil {
                                return fmt.Errorf("failed to get network from store during leave: %v", err)
                            }
                        Severity: Major
                        Found in libnetwork/endpoint.go - About 1 hr to fix

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

                          func setupIPChains(config configuration, version iptables.IPVersion) (natChain *iptables.ChainInfo, filterChain *iptables.ChainInfo, isolationChain1 *iptables.ChainInfo, isolationChain2 *iptables.ChainInfo, retErr error) {
                              // Sanity check.
                              if version == iptables.IPv4 && !config.EnableIPTables {
                                  return nil, nil, nil, nil, errors.New("cannot create new chains, iptables is disabled")
                              }
                          Severity: Major
                          Found in libnetwork/drivers/bridge/setup_ip_tables_linux.go - About 1 hr to fix

                            Method networkRouter.getNetwork has 10 return statements (exceeds 4 allowed).
                            Open

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

                              Method imageRouter.postImagesCreate has 10 return statements (exceeds 4 allowed).
                              Open

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

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

                                func newImageBuildOptions(ctx context.Context, r *http.Request) (*types.ImageBuildOptions, error) {
                                    options := &types.ImageBuildOptions{
                                        Version:        types.BuilderV1, // Builder V1 is the default, but can be overridden
                                        Dockerfile:     r.FormValue("dockerfile"),
                                        SuppressOutput: httputils.BoolValue(r, "q"),
                                Severity: Major
                                Found in api/server/router/build/build_routes.go - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language