dotcloud/docker

View on GitHub

Showing 1,885 of 1,885 total issues

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

func createMacVlan(containerIfName, parent, macvlanMode string) (string, error) {
    // Set the macvlan mode. Default is bridge mode
    mode, err := setMacVlanMode(macvlanMode)
    if err != nil {
        return "", fmt.Errorf("Unsupported %s macvlan mode: %v", macvlanMode, err)
Severity: Major
Found in libnetwork/drivers/macvlan/macvlan_setup.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

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

      func delVlanLink(linkName string) error {
          if strings.Contains(linkName, ".") {
              _, _, err := parseVlan(linkName)
              if err != nil {
                  return err
      Severity: Major
      Found in libnetwork/drivers/macvlan/macvlan_setup.go - About 35 mins to fix

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

        func (d *driver) RevokeExternalConnectivity(nid, eid string) error {
            network, err := d.getNetwork(nid)
            if err != nil {
                return err
            }
        Severity: Major
        Found in libnetwork/drivers/bridge/bridge_linux.go - About 35 mins to fix

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

          func (d *driver) createNetwork(config *configuration) (bool, error) {
              foundExisting := false
              networkList := d.getNetworks()
              for _, nw := range networkList {
                  if config.Parent == nw.config.Parent {
          Severity: Major
          Found in libnetwork/drivers/macvlan/macvlan_network.go - About 35 mins to fix

            Method NetworkDB.bulkSyncTables has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
            Open

            func (nDB *NetworkDB) bulkSyncTables() {
                var networks []string
                nDB.RLock()
                for nid, network := range nDB.networks[nDB.config.NodeID] {
                    if network.leaving {
            Severity: Minor
            Found in libnetwork/networkdb/cluster.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

            Method networkConfiguration.Conflicts has 5 return statements (exceeds 4 allowed).
            Open

            func (c *networkConfiguration) Conflicts(o *networkConfiguration) error {
                if o == nil {
                    return errors.New("same configuration")
                }
            
            
            Severity: Major
            Found in libnetwork/drivers/bridge/bridge_linux.go - About 35 mins to fix

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

              func (d *driver) createNetwork(config *networkConfiguration) (err error) {
                  // Initialize handle when needed
                  d.Lock()
                  if d.nlh == nil {
                      d.nlh = ns.NlHandle()
              Severity: Major
              Found in libnetwork/drivers/bridge/bridge_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, "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

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

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

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

                          func makePluginAdapter(p getter.CompatPlugin) (*volumeDriverAdapter, error) {
                              if pc, ok := p.(getter.PluginWithV1Client); ok {
                                  return &volumeDriverAdapter{name: p.Name(), scopePath: p.ScopedPath, proxy: &volumeDriverProxy{pc.Client()}}, nil
                              }
                          
                          
                          Severity: Major
                          Found in volume/drivers/extpoint.go - About 35 mins to fix

                            Method ViewDB.GetByPrefix has 5 return statements (exceeds 4 allowed).
                            Open

                            func (db *ViewDB) GetByPrefix(s string) (string, error) {
                                if s == "" {
                                    return "", errdefs.InvalidParameter(errors.New("prefix can't be empty"))
                                }
                                iter, err := db.store.Txn(false).Get(memdbContainersTable, memdbIDIndexPrefix, s)
                            Severity: Major
                            Found in container/view.go - About 35 mins to fix

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

                              func (cli *Client) SecretInspectWithRaw(ctx context.Context, id string) (swarm.Secret, []byte, error) {
                                  if err := cli.NewVersionError(ctx, "1.25", "secret inspect"); err != nil {
                                      return swarm.Secret{}, nil, err
                                  }
                                  if id == "" {
                              Severity: Major
                              Found in client/secret_inspect.go - About 35 mins to fix

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

                                func (cli *Client) BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) {
                                    if err := cli.NewVersionError(ctx, "1.31", "build prune"); err != nil {
                                        return nil, err
                                    }
                                
                                
                                Severity: Major
                                Found in client/build_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 endpoint.UnmarshalJSON has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (ep *endpoint) UnmarshalJSON(b []byte) error {
                                        var (
                                            err   error
                                            epMap map[string]interface{}
                                        )
                                    Severity: Major
                                    Found in libnetwork/drivers/ipvlan/ipvlan_store.go - About 35 mins to fix

                                      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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language