dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method Daemon.findAndAttachNetwork has 65 lines of code (exceeds 50 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 1 hr to fix

    Method pusher.pushTag has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
    Open

    func (p *pusher) pushTag(ctx context.Context, ref reference.NamedTagged, id digest.Digest) error {
        log.G(ctx).Debugf("Pushing repository: %s", reference.FamiliarString(ref))
    
        imgConfig, err := p.config.ImageStore.Get(ctx, id)
        if err != nil {
    Severity: Minor
    Found in distribution/push_v2.go - About 1 hr 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 puller.pullTag has 17 return statements (exceeds 4 allowed).
    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: Major
    Found in distribution/pull_v2.go - About 1 hr to fix

      Method pusher.pushTag has 17 return statements (exceeds 4 allowed).
      Open

      func (p *pusher) pushTag(ctx context.Context, ref reference.NamedTagged, id digest.Digest) error {
          log.G(ctx).Debugf("Pushing repository: %s", reference.FamiliarString(ref))
      
          imgConfig, err := p.config.ImageStore.Get(ctx, id)
          if err != nil {
      Severity: Major
      Found in distribution/push_v2.go - About 1 hr to fix

        Method Controller.handleEpTableEvent has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
        Open

        func (c *Controller) handleEpTableEvent(ev events.Event) {
            var (
                nid   string
                eid   string
                value []byte
        Severity: Minor
        Found in libnetwork/agent.go - About 1 hr 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 IPTable.ProgramChain has 17 return statements (exceeds 4 allowed).
        Open

        func (iptable IPTable) ProgramChain(c *ChainInfo, bridgeName string, hairpinMode, enable bool) error {
            if c.Name == "" {
                return errors.New("could not program chain, missing chain name")
            }
        
        
        Severity: Major
        Found in libnetwork/iptables/iptables.go - About 1 hr to fix

          Method PortAllocator.RequestPortsInRange has a Cognitive Complexity of 28 (exceeds 20 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

          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 driver.Join has 17 return statements (exceeds 4 allowed).
          Open

          func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error {
              ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.overlay.Join", trace.WithAttributes(
                  attribute.String("nid", nid),
                  attribute.String("eid", eid),
                  attribute.String("sboxKey", sboxKey)))
          Severity: Major
          Found in libnetwork/drivers/overlay/joinleave.go - About 1 hr to fix

            Method linuxParser.validateMountConfigImpl has 17 return statements (exceeds 4 allowed).
            Open

            func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSourceExists bool) error {
                if len(mnt.Target) == 0 {
                    return &errMountConfig{mnt, errMissingField("Target")}
                }
            
            
            Severity: Major
            Found in volume/mounts/linux_parser.go - About 1 hr to fix

              Method Builder.Build has 17 return statements (exceeds 4 allowed).
              Open

              func (b *Builder) Build(ctx context.Context, opt backend.BuildConfig) (*builder.Result, error) {
                  if len(opt.Options.Outputs) > 1 {
                      return nil, errors.Errorf("multiple outputs not supported")
                  }
              
              
              Severity: Major
              Found in builder/builder-next/builder.go - About 1 hr to fix

                Function ReadCertsDirectory has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                Open

                func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
                    fs, err := os.ReadDir(directory)
                    if err != nil && !os.IsNotExist(err) {
                        return invalidParam(err)
                    }
                Severity: Minor
                Found in registry/registry.go - About 1 hr 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 pushProgress.UpdateProgress has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                Open

                func (p *pushProgress) UpdateProgress(ctx context.Context, ongoing *jobs, out progress.Output, start time.Time) error {
                    for _, j := range ongoing.Jobs() {
                        key := remotes.MakeRefKey(ctx, j)
                        id := stringid.TruncateID(j.Digest.Encoded())
                
                
                Severity: Minor
                Found in daemon/containerd/progress.go - About 1 hr 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.createDiff has 17 return statements (exceeds 4 allowed).
                Open

                func (i *ImageService) createDiff(ctx context.Context, name string, sn snapshots.Snapshotter, cs content.Store, comparer diff.Comparer) (*ocispec.Descriptor, digest.Digest, error) {
                    info, err := sn.Stat(ctx, name)
                    if err != nil {
                        return nil, "", err
                    }
                Severity: Major
                Found in daemon/containerd/image_commit.go - About 1 hr to fix

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

                  func (daemon *Daemon) killWithSignal(container *containerpkg.Container, stopSignal syscall.Signal) error {
                      log.G(context.TODO()).WithFields(log.Fields{
                          "signal":    int(stopSignal),
                          "container": container.ID,
                      }).Debugf("sending signal %[1]d (%[1]s) to container", stopSignal)
                  Severity: Minor
                  Found in daemon/kill.go - About 1 hr 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.logServiceEvent has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (daemon *Daemon) logServiceEvent(action swarmapi.WatchActionKind, service *swarmapi.Service, oldService *swarmapi.Service) {
                      attributes := map[string]string{
                          "name": service.Spec.Annotations.Name,
                      }
                      eventTime := eventTimestamp(service.Meta, action)
                  Severity: Minor
                  Found in daemon/events.go - About 1 hr 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.handleContainerExit has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontainerdtypes.EventInfo) error {
                      var exitStatus container.ExitStatus
                      c.Lock()
                  
                      cfg := daemon.config()
                  Severity: Minor
                  Found in daemon/monitor.go - About 1 hr 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 New has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func New(name string, config Options) (Driver, error) {
                      ctx := context.TODO()
                      if name != "" {
                          log.G(ctx).Infof("[graphdriver] trying configured driver: %s", name)
                          if err := checkRemoved(name); err != nil {
                  Severity: Minor
                  Found in daemon/graphdriver/driver.go - About 1 hr 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.filterByNameIDMatches has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (daemon *Daemon) filterByNameIDMatches(view *container.View, filter *listContext) ([]container.Snapshot, error) {
                      idSearch := false
                      names := filter.filters.Get("name")
                      ids := filter.filters.Get("id")
                      if len(names)+len(ids) == 0 {
                  Severity: Minor
                  Found in daemon/list.go - About 1 hr 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.Images has 17 return statements (exceeds 4 allowed).
                  Open

                  func (i *ImageService) Images(ctx context.Context, opts imagetypes.ListOptions) ([]*imagetypes.Summary, error) {
                      if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
                          return nil, err
                      }
                  
                  
                  Severity: Major
                  Found in daemon/images/image_list.go - About 1 hr to fix

                    Method tarSum.Read has 17 return statements (exceeds 4 allowed).
                    Open

                    func (ts *tarSum) Read(buf []byte) (int, error) {
                        if ts.finished {
                            return ts.bufWriter.Read(buf)
                        }
                        if len(ts.bufData) < len(buf) {
                    Severity: Major
                    Found in pkg/tarsum/tarsum.go - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language