dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method Daemon.ContainerExecStart has 148 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, options backend.ExecStartConfig) (err error) {
    var (
        cStdin           io.ReadCloser
        cStdout, cStderr io.Writer
    )
Severity: Major
Found in daemon/exec.go - About 4 hrs to fix

    Method puller.pullTag has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func (p *puller) pullTag(ctx context.Context, ref reference.Named, platform *ocispec.Platform) (tagUpdated bool, err error) {
        var (
            tagOrDigest string // Used for logging/progress only
            dgst        digest.Digest
            mt          string
    Severity: Minor
    Found in distribution/pull_v2.go - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method layerDescriptor.Download has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func (ld *layerDescriptor) Download(ctx context.Context, progressOutput progress.Output) (io.ReadCloser, int64, error) {
        log.G(ctx).Debugf("pulling blob %q", ld.digest)
    
        var (
            err    error
    Severity: Minor
    Found in distribution/pull_v2.go - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method imageRouter.postImagesCreate has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    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: Minor
    Found in api/server/router/image/image_routes.go - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method Daemon.ContainerLogs has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func (daemon *Daemon) ContainerLogs(ctx context.Context, containerName string, config *containertypes.LogsOptions) (messages <-chan *backend.LogMessage, isTTY bool, retErr error) {
        ctx, span := tracing.StartSpan(ctx, "daemon.ContainerLogs")
        defer func() {
            span.SetStatus(retErr)
            span.End()
    Severity: Minor
    Found in daemon/logs.go - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method ImageService.LoadImage has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, platform *ocispec.Platform, outStream io.Writer, quiet bool) error {
        decompressed, err := dockerarchive.DecompressStream(inTar)
        if err != nil {
            return errors.Wrap(err, "failed to decompress input tar archive")
        }
    Severity: Minor
    Found in daemon/containerd/image_exporter.go - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function containerToGRPC has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func containerToGRPC(c *types.ContainerSpec) (*swarmapi.ContainerSpec, error) {
        containerSpec := &swarmapi.ContainerSpec{
            Image:          c.Image,
            Labels:         c.Labels,
            Command:        c.Command,
    Severity: Minor
    Found in daemon/cluster/convert/container.go - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method Daemon.findAndAttachNetwork has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func (daemon *Daemon) findAndAttachNetwork(ctr *container.Container, idOrName string, epConfig *networktypes.EndpointSettings) (*libnetwork.Network, *networktypes.NetworkingConfig, error) {
        id := getNetworkID(idOrName, epConfig)
    
        n, err := daemon.FindNetwork(id)
        if err != nil {
    Severity: Minor
    Found in daemon/container_operations.go - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method client.createWindows has 147 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions interface{}) (*container, error) {
        logger := c.logger.WithField("container", id)
        configuration := &hcsshim.ContainerConfig{
            SystemType:              "Container",
            Name:                    id,
    Severity: Major
    Found in libcontainerd/local/local_windows.go - About 4 hrs to fix

      Method driver.CreateEndpoint has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
      Open

      func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, _ map[string]interface{}) error {
          if ifInfo == nil {
              return errors.New("invalid interface info passed")
          }
      
      
      Severity: Minor
      Found in libnetwork/drivers/bridge/bridge_linux.go - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method Client.imageBuildOptionsToQuery has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
      Open

      func (cli *Client) imageBuildOptionsToQuery(ctx context.Context, options types.ImageBuildOptions) (url.Values, error) {
          query := url.Values{}
          if len(options.Tags) > 0 {
              query["t"] = options.Tags
          }
      Severity: Minor
      Found in client/image_build.go - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function WithNamespaces has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
      Open

      func WithNamespaces(daemon *Daemon, c *container.Container) coci.SpecOpts {
          return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
              userNS := false
              // user
              if c.HostConfig.UsernsMode.IsPrivate() {
      Severity: Minor
      Found in daemon/oci_linux.go - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method walker.walk has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
      Open

      func (w *walker) walk(path string, i1, i2 os.FileInfo) (err error) {
          // Register these nodes with the return trees, unless we're still at the
          // (already-created) roots:
          if path != "/" {
              if err := walkchunk(path, i1, w.dir1, w.root1); err != nil {
      Severity: Minor
      Found in pkg/archive/changes_linux.go - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method PeerRecord.Unmarshal has 143 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (m *PeerRecord) Unmarshal(dAtA []byte) error {
          l := len(dAtA)
          iNdEx := 0
          for iNdEx < l {
              preIndex := iNdEx
      Severity: Major
      Found in libnetwork/drivers/overlay/overlay.pb.go - About 4 hrs to fix

        Method PluginPrivilege.Unmarshal has 143 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (m *PluginPrivilege) Unmarshal(dAtA []byte) error {
            l := len(dAtA)
            iNdEx := 0
            for iNdEx < l {
                preIndex := iNdEx
        Severity: Major
        Found in api/types/swarm/runtime/plugin.pb.go - About 4 hrs to fix

          Function DefaultLinuxSpec has 142 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func DefaultLinuxSpec() specs.Spec {
              return specs.Spec{
                  Version: specs.Version,
                  Process: &specs.Process{
                      Capabilities: &specs.LinuxCapabilities{
          Severity: Major
          Found in oci/defaults.go - About 4 hrs to fix

            Method ImageService.imageSummary has 142 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (i *ImageService) imageSummary(ctx context.Context, img images.Image, platformMatcher platforms.MatchComparer,
                opts imagetypes.ListOptions, tagsByDigest map[digest.Digest][]string,
            ) (_ *imagetypes.Summary, allChainIDs []digest.Digest, _ error) {
                var manifestSummaries []imagetypes.ManifestSummary
            
            
            Severity: Major
            Found in daemon/containerd/image_list.go - About 4 hrs to fix

              Method Daemon.buildSandboxOptions has 141 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (daemon *Daemon) buildSandboxOptions(cfg *config.Config, ctr *container.Container) ([]libnetwork.SandboxOption, error) {
                  var sboxOptions []libnetwork.SandboxOption
                  sboxOptions = append(sboxOptions, libnetwork.OptionHostname(ctr.Config.Hostname), libnetwork.OptionDomainname(ctr.Config.Domainname))
              
                  if ctr.HostConfig.NetworkMode.IsHost() {
              Severity: Major
              Found in daemon/container_operations.go - About 4 hrs to fix

                File layer_store.go has 609 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                package layer // import "github.com/docker/docker/layer"
                
                import (
                    "context"
                    "errors"
                Severity: Minor
                Found in layer/layer_store.go - About 4 hrs to fix

                  Method Cluster.CreateService has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRegistry bool) (*swarm.ServiceCreateResponse, error) {
                      var resp *swarm.ServiceCreateResponse
                      err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                          err := c.populateNetworkID(ctx, state.controlClient, &s)
                          if err != nil {
                  Severity: Minor
                  Found in daemon/cluster/services.go - About 4 hrs to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language