dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

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

func (cli *Client) PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (rc io.ReadCloser, err error) {
    query := url.Values{}
    if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil {
        return nil, errors.Wrap(err, "invalid remote reference")
    }
Severity: Major
Found in client/plugin_install.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

      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

        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 Client.ImagePush has 7 return statements (exceeds 4 allowed).
          Open

          func (cli *Client) ImagePush(ctx context.Context, image string, options image.PushOptions) (io.ReadCloser, error) {
              ref, err := reference.ParseNormalizedNamed(image)
              if err != nil {
                  return nil, err
              }
          Severity: Major
          Found in client/image_push.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

            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

              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.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

                  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

                    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

                      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 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

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

                              func patchImageConfig(dt []byte, dps []digest.Digest, history []ocispec.History, cache *exptypes.InlineCacheEntry) ([]byte, error) {
                                  m := map[string]json.RawMessage{}
                                  if err := json.Unmarshal(dt, &m); err != nil {
                                      return nil, errors.Wrap(err, "failed to parse image config for patch")
                                  }
                              Severity: Major
                              Found in builder/builder-next/exporter/mobyexporter/writer.go - About 45 mins to fix

                                Method buildRouter.postBuild has 7 return statements (exceeds 4 allowed).
                                Open

                                func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                                    var (
                                        notVerboseBuffer = bytes.NewBuffer(nil)
                                        version          = httputils.VersionFromContext(ctx)
                                    )
                                Severity: Major
                                Found in api/server/router/build/build_routes.go - About 45 mins to fix

                                  Method Service.Search has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *registry.AuthConfig, headers map[string][]string) ([]registry.SearchResult, error) {
                                  Severity: Minor
                                  Found in registry/search.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