dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

State has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

type State struct {
    // This Mutex is exported by design and is used as a global lock
    // for both the State and the Container it's embedded in.
    sync.Mutex
    // Note that `Running` and `Paused` are not mutually exclusive:
Severity: Minor
Found in container/state.go - About 3 hrs to fix

    Method ImageService.setupFilters has 100 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (i *ImageService) setupFilters(ctx context.Context, imageFilters filters.Args) (filterFunc imageFilterFunc, outErr error) {
        var fltrs []imageFilterFunc
        err := imageFilters.WalkValues("before", func(value string) error {
            img, err := i.GetImage(ctx, value, backend.GetImageOpts{})
            if err != nil {
    Severity: Major
    Found in daemon/containerd/image_list.go - About 3 hrs to fix

      Method LogEntry.Unmarshal has 34 return statements (exceeds 4 allowed).
      Open

      func (m *LogEntry) Unmarshal(dAtA []byte) error {
          l := len(dAtA)
          iNdEx := 0
          for iNdEx < l {
              preIndex := iNdEx
      Severity: Major
      Found in api/types/plugins/logdriver/entry.pb.go - About 3 hrs to fix

        Method Cluster.UpdateService has 100 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swarm.ServiceSpec, flags types.ServiceUpdateOptions, queryRegistry bool) (*swarm.ServiceUpdateResponse, error) {
            var resp *swarm.ServiceUpdateResponse
        
            err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                err := c.populateNetworkID(ctx, state.controlClient, &spec)
        Severity: Major
        Found in daemon/cluster/services.go - About 3 hrs to fix

          Method Daemon.openContainerFS has 100 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) openContainerFS(ctr *container.Container) (_ *containerFSView, retErr error) {
              ctx := context.TODO()
          
              if err := daemon.Mount(ctr); err != nil {
                  return nil, err
          Severity: Major
          Found in daemon/containerfs_linux.go - About 3 hrs to fix

            Method pusher.pushTag has 99 lines of code (exceeds 50 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: Major
            Found in distribution/push_v2.go - About 2 hrs to fix

              Method driver.CreateEndpoint has 98 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
                  var err error
                  if err = validateID(nid, eid); err != nil {
                      return err
                  }
              Severity: Major
              Found in libnetwork/drivers/windows/overlay/ov_endpoint_windows.go - About 2 hrs to fix

                Function newImageBuildOptions has 98 lines of code (exceeds 50 allowed). Consider refactoring.
                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 2 hrs to fix

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

                  func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS image.RootFS, layers []DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) {
                      var (
                          topLayer       layer.Layer
                          topDownload    *downloadTransfer
                          watcher        *watcher
                  Severity: Minor
                  Found in distribution/xfer/download.go - About 2 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 Endpoint.sbLeave has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                  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: Minor
                  Found in libnetwork/endpoint.go - About 2 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 networkConfiguration.fromLabels has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (c *networkConfiguration) fromLabels(labels map[string]string) error {
                      var err error
                      for label, value := range labels {
                          switch label {
                          case BridgeName:
                  Severity: Minor
                  Found in libnetwork/drivers/bridge/bridge_linux.go - About 2 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 BulkSyncMessage.Unmarshal has 33 return statements (exceeds 4 allowed).
                  Open

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

                    Method container.createIO has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (c *container) createIO(fifos *cio.FIFOSet, stdinCloseSync chan containerd.Process, attachStdio libcontainerdtypes.StdioCallback) (cio.IO, error) {
                        var (
                            io  *cio.DirectIO
                            err error
                        )
                    Severity: Minor
                    Found in libcontainerd/remote/client.go - About 2 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 Cluster.resolveSystemAddr has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (c *Cluster) resolveSystemAddr() (net.IP, error) {
                        // Use the system's only device IP address, or fail if there are
                        // multiple addresses to choose from.
                        interfaces, err := nlwrap.LinkList()
                        if err != nil {
                    Severity: Minor
                    Found in daemon/cluster/listen_addr_linux.go - About 2 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 Cluster.Init has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (c *Cluster) Init(req types.InitRequest) (string, error) {
                        c.controlMutex.Lock()
                        defer c.controlMutex.Unlock()
                        if c.nr != nil {
                            if req.ForceNewCluster {
                    Severity: Minor
                    Found in daemon/cluster/swarm.go - About 2 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 StdCopy has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error) {
                        var (
                            buf       = make([]byte, startingBufLen)
                            bufLen    = len(buf)
                            nr, nw    int
                    Severity: Minor
                    Found in pkg/stdcopy/stdcopy.go - About 2 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 skipOverlay has 97 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func skipOverlay(dAtA []byte) (n int, err error) {
                        l := len(dAtA)
                        iNdEx := 0
                        for iNdEx < l {
                            var wire uint64
                    Severity: Major
                    Found in libnetwork/drivers/windows/overlay/overlay.pb.go - About 2 hrs to fix

                      Method imageRouter.postImagesCreate has 96 lines of code (exceeds 50 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: Major
                      Found in api/server/router/image/image_routes.go - About 2 hrs to fix

                        Method Cluster.Init has 96 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (c *Cluster) Init(req types.InitRequest) (string, error) {
                            c.controlMutex.Lock()
                            defer c.controlMutex.Unlock()
                            if c.nr != nil {
                                if req.ForceNewCluster {
                        Severity: Major
                        Found in daemon/cluster/swarm.go - About 2 hrs to fix

                          Method ImageService.LoadImage has 96 lines of code (exceeds 50 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: Major
                          Found in daemon/containerd/image_exporter.go - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language