dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Function loginV2 has 5 return statements (exceeds 4 allowed).
Open

func loginV2(authConfig *registry.AuthConfig, endpoint APIEndpoint, userAgent string) (string, string, error) {
    var (
        endpointStr          = strings.TrimRight(endpoint.URL.String(), "/") + "/v2/"
        modifiers            = Headers(userAgent, nil)
        authTransport        = transport.NewTransport(newTransport(endpoint.TLSConfig), modifiers...)
Severity: Major
Found in registry/auth.go - About 35 mins to fix

    Function newDaemonCommand has 5 return statements (exceeds 4 allowed).
    Open

    func newDaemonCommand() (*cobra.Command, error) {
        // FIXME(thaJeztah): config.New also looks up default binary-path, but this code is also executed when running "--version".
        cfg, err := config.New()
        if err != nil {
            return nil, err
    Severity: Major
    Found in cmd/dockerd/docker.go - About 35 mins to fix

      Function setupInternalNetworkRules has 5 return statements (exceeds 4 allowed).
      Open

      func setupInternalNetworkRules(bridgeIface string, addr *net.IPNet, icc, insert bool) error {
          var version iptables.IPVersion
          var inDropRule, outDropRule iptRule
      
          // Either add or remove the interface from the firewalld zone, if firewalld is running.
      Severity: Major
      Found in libnetwork/drivers/bridge/setup_ip_tables_linux.go - About 35 mins to fix

        Method driver.Join has 5 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, fmt.Sprintf("libnetwork.drivers.windows_%s.Join", d.name), trace.WithAttributes(
                attribute.String("nid", nid),
                attribute.String("eid", eid),
                attribute.String("sboxKey", sboxKey)))
        Severity: Major
        Found in libnetwork/drivers/windows/windows.go - About 35 mins to fix

          Method driver.Join has 5 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.windows_overlay.Join", trace.WithAttributes(
                  attribute.String("nid", nid),
                  attribute.String("eid", eid),
                  attribute.String("sboxKey", sboxKey)))
          Severity: Major
          Found in libnetwork/drivers/windows/overlay/joinleave_windows.go - About 35 mins to fix

            Method VolumeStore.restore has 5 return statements (exceeds 4 allowed).
            Open

            func (s *VolumeStore) restore() {
                var ls []volumeMetadata
                s.db.View(func(tx *bolt.Tx) error {
                    ls = listMeta(tx)
                    return nil
            Severity: Major
            Found in volume/service/restore.go - About 35 mins to fix

              Method driver.DeleteEndpoint has 5 return statements (exceeds 4 allowed).
              Open

              func (d *driver) DeleteEndpoint(nid, eid string) error {
                  if err := validateID(nid, eid); err != nil {
                      return err
                  }
              
              
              Severity: Major
              Found in libnetwork/drivers/windows/overlay/ov_endpoint_windows.go - About 35 mins to fix

                Method driver.CreateEndpoint has 5 return statements (exceeds 4 allowed).
                Open

                func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
                    if err := validateID(nid, eid); err != nil {
                        return err
                    }
                    n, err := d.getNetwork(nid)
                Severity: Major
                Found in libnetwork/drivers/ipvlan/ipvlan_endpoint.go - About 35 mins to fix

                  Method cnmNetworkAllocator.AllocateService has 5 return statements (exceeds 4 allowed).
                  Open

                  func (na *cnmNetworkAllocator) AllocateService(s *api.Service) (err error) {
                      defer func() {
                          if err != nil {
                              na.DeallocateService(s)
                          }
                  Severity: Major
                  Found in libnetwork/cnmallocator/networkallocator.go - About 35 mins to fix

                    Method Client.ContainerCreate has a Cognitive Complexity of 22 (exceeds 20 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) {
                        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: Minor
                    Found in client/container_create.go - About 35 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

                    Function NewClientWithOpts has 5 return statements (exceeds 4 allowed).
                    Open

                    func NewClientWithOpts(ops ...Opt) (*Client, error) {
                        hostURL, err := ParseHostURL(DefaultDockerHost)
                        if err != nil {
                            return nil, err
                        }
                    Severity: Major
                    Found in client/client.go - About 35 mins to fix

                      Method windowsParser.ParseVolumesFrom has 5 return statements (exceeds 4 allowed).
                      Open

                      func (p *windowsParser) ParseVolumesFrom(spec string) (string, string, error) {
                          if len(spec) == 0 {
                              return "", "", fmt.Errorf("volumes-from specification cannot be an empty string")
                          }
                      
                      
                      Severity: Major
                      Found in volume/mounts/windows_parser.go - About 35 mins to fix

                        Method Service.lookupV2Endpoints has 5 return statements (exceeds 4 allowed).
                        Open

                        func (s *Service) lookupV2Endpoints(hostname string) (endpoints []APIEndpoint, err error) {
                            ana := s.config.allowNondistributableArtifacts(hostname)
                        
                            if hostname == DefaultNamespace || hostname == IndexHostname {
                                for _, mirror := range s.config.Mirrors {
                        Severity: Major
                        Found in registry/service_v2.go - About 35 mins to fix

                          Method Client.ContainersPrune has 5 return statements (exceeds 4 allowed).
                          Open

                          func (cli *Client) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (container.PruneReport, error) {
                              if err := cli.NewVersionError(ctx, "1.25", "container prune"); err != nil {
                                  return container.PruneReport{}, err
                              }
                          
                          
                          Severity: Major
                          Found in client/container_prune.go - About 35 mins to fix

                            Method Client.ImagesPrune has 5 return statements (exceeds 4 allowed).
                            Open

                            func (cli *Client) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (image.PruneReport, error) {
                                if err := cli.NewVersionError(ctx, "1.25", "image prune"); err != nil {
                                    return image.PruneReport{}, err
                                }
                            
                            
                            Severity: Major
                            Found in client/image_prune.go - About 35 mins to fix

                              Method Service.Auth has 5 return statements (exceeds 4 allowed).
                              Open

                              func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, userAgent string) (status, token string, err error) {
                                  // TODO Use ctx when searching for repositories
                                  registryHostName := IndexHostname
                              
                                  if authConfig.ServerAddress != "" {
                              Severity: Major
                              Found in registry/service.go - About 35 mins to fix

                                Method authTransport.RoundTrip has 5 return statements (exceeds 4 allowed).
                                Open

                                func (tr *authTransport) RoundTrip(orig *http.Request) (*http.Response, error) {
                                    // Authorization should not be set on 302 redirect for untrusted locations.
                                    // This logic mirrors the behavior in addRequiredHeadersToRedirectedRequests.
                                    // As the authorization logic is currently implemented in RoundTrip,
                                    // a 302 redirect is detected by looking at the Referrer header as go http package adds said header.
                                Severity: Major
                                Found in registry/search_session.go - About 35 mins to fix

                                  Method lazySource.Hash has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (c *lazySource) Hash(path string) (string, error) {
                                      cleanPath, fullPath, err := normalize(path, c.root)
                                      if err != nil {
                                          return "", err
                                      }
                                  Severity: Major
                                  Found in builder/remotecontext/lazycontext.go - About 35 mins to fix

                                    Method Worker.ResolveSourceMetadata has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (w *Worker) ResolveSourceMetadata(ctx context.Context, op *pb.SourceOp, opt sourceresolver.Opt, sm *session.Manager, g session.Group) (*sourceresolver.MetaResponse, error) {
                                        if opt.SourcePolicies != nil {
                                            return nil, errors.New("source policies can not be set for worker")
                                        }
                                    
                                    
                                    Severity: Major
                                    Found in builder/builder-next/worker/worker.go - About 35 mins to fix

                                      Method Container.StatPath has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (container *Container) StatPath(resolvedPath, absPath string) (stat *containertypes.PathStat, err error) {
                                          if container.BaseFS == "" {
                                              return nil, errors.New("StatPath: BaseFS of container " + container.ID + " is unexpectedly empty")
                                          }
                                      
                                      
                                      Severity: Major
                                      Found in container/archive_windows.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language