dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Function main has 53 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func main() {
    ipPtr := flag.String("ip", "127.0.0.1", "ip address")
    portPtr := flag.Int("port", 2000, "port")
    networkPtr := flag.String("net", "", "target network")
    tablePtr := flag.String("t", "", "table to process <sd/overlay>")
Severity: Minor
Found in libnetwork/cmd/diagnostic/main.go - About 1 hr to fix

    Method driver.DiscoverNew has 53 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
        switch dType {
        case discoverapi.NodeDiscovery:
            nodeData, ok := data.(discoverapi.NodeDiscoveryData)
            if !ok {
    Severity: Minor
    Found in libnetwork/drivers/overlay/overlay.go - About 1 hr to fix

      Function dispatchRun has 53 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func dispatchRun(ctx context.Context, d dispatchRequest, c *instructions.RunCommand) error {
          if err := image.CheckOS(d.state.operatingSystem); err != nil {
              return err
          }
      
      
      Severity: Minor
      Found in builder/dockerfile/dispatchers.go - About 1 hr to fix

        Method ImageService.GetImageAndReleasableLayer has 53 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (i *ImageService) GetImageAndReleasableLayer(ctx context.Context, refOrID string, opts backend.GetImageAndLayerOptions) (builder.Image, builder.ROLayer, error) {
            if refOrID == "" { // FROM scratch
                if runtime.GOOS == "windows" {
                    return nil, nil, fmt.Errorf(`"FROM scratch" is not supported on Windows`)
                }
        Severity: Minor
        Found in daemon/containerd/image_builder.go - About 1 hr to fix

          Method Daemon.containerArchivePath has 53 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) containerArchivePath(container *container.Container, path string) (content io.ReadCloser, stat *containertypes.PathStat, err error) {
              container.Lock()
          
              defer func() {
                  if err != nil {
          Severity: Minor
          Found in daemon/archive_windows.go - About 1 hr to fix

            Method ImageService.CommitImage has 53 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (i *ImageService) CommitImage(ctx context.Context, c backend.CommitConfig) (image.ID, error) {
                if err := ctx.Err(); err != nil {
                    return "", err
                }
            
            
            Severity: Minor
            Found in daemon/images/image_commit.go - About 1 hr to fix

              Method JSONProgress.String has 53 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (p *JSONProgress) String() string {
                  var (
                      width       = p.width()
                      pbBox       string
                      numbersBox  string
              Severity: Minor
              Found in pkg/jsonmessage/jsonmessage.go - About 1 hr to fix

                Method Manager.Push has 11 return statements (exceeds 4 allowed).
                Open

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

                  Function Push has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func Push(ctx context.Context, ref reference.Named, config *ImagePushConfig) error {
                      // FIXME: Allow to interrupt current push when new push of same image is done.
                  
                      // Resolve the Repository name from fqn to RepositoryInfo
                      repoInfo, err := config.RegistryService.ResolveRepository(ref)
                  Severity: Minor
                  Found in distribution/push.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 ImageCache.GetCache has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                  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: Minor
                  Found in image/cache/cache.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 SwitchRoot has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func SwitchRoot(path string) error {
                      if mounted, _ := mountinfo.Mounted(path); !mounted {
                          if err := mount.Mount(path, path, "bind", "rbind,rw"); err != nil {
                              return realChroot(path)
                          }
                  Severity: Minor
                  Found in internal/mounttree/switchroot_linux.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 Allocator.RequestPool has 11 return statements (exceeds 4 allowed).
                  Open

                  func (a *Allocator) RequestPool(req ipamapi.PoolRequest) (ipamapi.AllocatedPool, error) {
                      log.G(context.TODO()).Debugf("RequestPool: %+v", req)
                  
                      parseErr := func(err error) error {
                          return types.InternalErrorf("failed to parse pool request for address space %q pool %q subpool %q: %v", req.AddressSpace, req.Pool, req.SubPool, err)
                  Severity: Major
                  Found in libnetwork/ipams/defaultipam/allocator.go - About 1 hr to fix

                    Method Sandbox.delete has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (sb *Sandbox) delete(ctx context.Context, force bool) error {
                        sb.mu.Lock()
                        if sb.inDelete {
                            sb.mu.Unlock()
                            return types.ForbiddenErrorf("another sandbox delete in progress")
                    Severity: Minor
                    Found in libnetwork/sandbox.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 skipAgent has 11 return statements (exceeds 4 allowed).
                    Open

                    func skipAgent(dAtA []byte) (n int, err error) {
                        l := len(dAtA)
                        iNdEx := 0
                        depth := 0
                        for iNdEx < l {
                    Severity: Major
                    Found in libnetwork/agent.pb.go - About 1 hr to fix

                      Function skipOverlay has 11 return statements (exceeds 4 allowed).
                      Open

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

                        Function skipNetworkdb has 11 return statements (exceeds 4 allowed).
                        Open

                        func skipNetworkdb(dAtA []byte) (n int, err error) {
                            l := len(dAtA)
                            iNdEx := 0
                            depth := 0
                            for iNdEx < l {
                        Severity: Major
                        Found in libnetwork/networkdb/networkdb.pb.go - About 1 hr to fix

                          Method driver.link has 11 return statements (exceeds 4 allowed).
                          Open

                          func (d *driver) link(network *bridgeNetwork, endpoint *bridgeEndpoint, enable bool) (retErr error) {
                              cc := endpoint.containerConfig
                              ec := endpoint.extConnConfig
                              if cc == nil || ec == nil || (len(cc.ParentEndpoints) == 0 && len(cc.ChildEndpoints) == 0) {
                                  // nothing to do
                          Severity: Major
                          Found in libnetwork/drivers/bridge/bridge_linux.go - About 1 hr to fix

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

                            func (d *driver) deleteNetwork(nid string) error {
                                var err error
                            
                                // Get network handler and remove it from driver
                                d.Lock()
                            Severity: Minor
                            Found in libnetwork/drivers/bridge/bridge_linux.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 cnmNetworkAllocator.allocateNetworkIPs has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (na *cnmNetworkAllocator) allocateNetworkIPs(nAttach *api.NetworkAttachment) error {
                                var ip *net.IPNet
                                var opts map[string]string
                            
                                ipam, _, _, err := na.resolveIPAM(nAttach.Network)
                            Severity: Minor
                            Found in libnetwork/cnmallocator/networkallocator.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 bridgeNetwork.setupIPTables has 11 return statements (exceeds 4 allowed).
                            Open

                            func (n *bridgeNetwork) setupIPTables(ipVersion iptables.IPVersion, maskedAddr *net.IPNet, config *networkConfiguration, i *bridgeInterface) error {
                                var err error
                            
                                d := n.driver
                                d.Lock()
                            Severity: Major
                            Found in libnetwork/drivers/bridge/setup_ip_tables_linux.go - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language