dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Avoid deeply nested control flow statements.
Open

                    if iNdEx >= l {
                        return 0, io.ErrUnexpectedEOF
                    }
Severity: Major
Found in libnetwork/drivers/windows/overlay/overlay.pb.go - About 45 mins to fix

    Method driver.CreateEndpoint has a Cognitive Complexity of 23 (exceeds 20 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: Minor
    Found in libnetwork/drivers/windows/overlay/ov_endpoint_windows.go - About 45 mins 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.ContainerCreate has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error) {
    Severity: Minor
    Found in client/container_create.go - About 45 mins to fix

      Method VolumesService.Prune has 7 return statements (exceeds 4 allowed).
      Open

      func (s *VolumesService) Prune(ctx context.Context, filter filters.Args) (*volumetypes.PruneReport, error) {
          if !s.pruneRunning.CompareAndSwap(false, true) {
              return nil, errdefs.Conflict(errors.New("a prune operation is already running"))
          }
          defer s.pruneRunning.Store(false)
      Severity: Major
      Found in volume/service/service.go - About 45 mins to fix

        Function parseEndpointOptions has 7 return statements (exceeds 4 allowed).
        Open

        func parseEndpointOptions(epOptions map[string]interface{}) (*endpointOption, error) {
            if epOptions == nil {
                return nil, nil
            }
        
        
        Severity: Major
        Found in libnetwork/drivers/windows/windows.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if shift >= 64 {
                                  return 0, ErrIntOverflowOverlay
                              }
          Severity: Major
          Found in libnetwork/drivers/windows/overlay/overlay.pb.go - About 45 mins to fix

            Method cnmNetworkAllocator.IsServiceAllocated has 7 return statements (exceeds 4 allowed).
            Open

            func (na *cnmNetworkAllocator) IsServiceAllocated(s *api.Service, flags ...func(*networkallocator.ServiceAllocationOpts)) bool {
                specNetworks := serviceNetworks(s)
            
                // If endpoint mode is VIP and allocator does not have the
                // service in VIP allocated set then it needs to be allocated.
            Severity: Major
            Found in libnetwork/cnmallocator/networkallocator.go - About 45 mins to fix

              Method windowsParser.splitRawSpec has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
              Open

              func (p *windowsParser) splitRawSpec(raw string, splitRegexp *regexp.Regexp) ([]string, error) {
                  match := splitRegexp.FindStringSubmatch(strings.ToLower(raw))
                  if len(match) == 0 {
                      return nil, errInvalidSpec(raw)
                  }
              Severity: Minor
              Found in volume/mounts/windows_parser.go - About 45 mins 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

              Avoid deeply nested control flow statements.
              Open

                                  if b < 0x80 {
                                      break
                                  }
              Severity: Major
              Found in libnetwork/drivers/windows/overlay/overlay.pb.go - About 45 mins to fix

                Method driver.peerAdd has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
                Severity: Minor
                Found in libnetwork/drivers/windows/overlay/peerdb_windows.go - About 45 mins to fix

                  Method driver.peerDelete has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
                  Severity: Minor
                  Found in libnetwork/drivers/windows/overlay/peerdb_windows.go - About 45 mins to fix

                    Method requestReader.Read has 7 return statements (exceeds 4 allowed).
                    Open

                    func (r *requestReader) Read(p []byte) (n int, err error) {
                        if r.client == nil || r.request == nil {
                            return 0, fmt.Errorf("client and request can't be nil")
                        }
                        isFreshRequest := false
                    Severity: Major
                    Found in registry/resumable/resumablerequestreader.go - About 45 mins to fix

                      Method driver.peerAdd has 7 return statements (exceeds 4 allowed).
                      Open

                      func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
                          log.G(context.TODO()).Debugf("WINOVERLAY: Enter peerAdd for ca ip %s with ca mac %s", peerIP.String(), peerMac.String())
                      
                          if err := validateID(nid, eid); err != nil {
                              return err
                      Severity: Major
                      Found in libnetwork/drivers/windows/overlay/peerdb_windows.go - About 45 mins to fix

                        Method Client.ContainerCreate has 7 return statements (exceeds 4 allowed).
                        Open

                        func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error) {
                            var response container.CreateResponse
                        
                            // Make sure we negotiated (if the client is configured to do so),
                            // as code below contains API-version specific handling of options.
                        Severity: Major
                        Found in client/container_create.go - About 45 mins to fix

                          Function createVlanLink has 7 return statements (exceeds 4 allowed).
                          Open

                          func createVlanLink(parentName string) error {
                              if strings.Contains(parentName, ".") {
                                  parent, vidInt, err := parseVlan(parentName)
                                  if err != nil {
                                      return err
                          Severity: Major
                          Found in libnetwork/drivers/ipvlan/ipvlan_setup.go - About 45 mins to fix

                            Method Store.lookup has 7 return statements (exceeds 4 allowed).
                            Open

                            func (s *Store) lookup(name string, mode int) (volume.Driver, error) {
                                if name == "" {
                                    return nil, errdefs.InvalidParameter(errors.New("driver name cannot be empty"))
                                }
                                s.driverLock.Lock(name)
                            Severity: Major
                            Found in volume/drivers/extpoint.go - About 45 mins to fix

                              Function ExecT has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func ExecT(ctx context.Context, t testing.TB, apiClient client.APIClient, id string, cmd []string, ops ...func(*container.ExecOptions)) ExecResult {
                              Severity: Minor
                              Found in integration/internal/container/exec.go - About 45 mins to fix

                                Function ReadCertsDirectory has 7 return statements (exceeds 4 allowed).
                                Open

                                func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
                                    fs, err := os.ReadDir(directory)
                                    if err != nil && !os.IsNotExist(err) {
                                        return invalidParam(err)
                                    }
                                Severity: Major
                                Found in registry/registry.go - About 45 mins to fix

                                  Function dispatchRun has 7 return statements (exceeds 4 allowed).
                                  Open

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

                                    Method swarmRouter.updateCluster has 7 return statements (exceeds 4 allowed).
                                    Open

                                    func (sr *swarmRouter) updateCluster(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                                        var swarm types.Spec
                                        if err := httputils.ReadJSON(r, &swarm); err != nil {
                                            return err
                                        }
                                    Severity: Major
                                    Found in api/server/router/swarm/cluster_routes.go - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language