dotcloud/docker

View on GitHub
libnetwork/ipams/defaultipam/allocator.go

Summary

Maintainability
A
3 hrs
Test Coverage

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

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

    func NewAllocator(lcAs, glAs []*ipamutils.NetworkToSplit) (*Allocator, error) {
        var (
            a                          Allocator
            err                        error
            lcAs4, lcAs6, glAs4, glAs6 []*ipamutils.NetworkToSplit
    Severity: Major
    Found in libnetwork/ipams/defaultipam/allocator.go - About 45 mins to fix

      Function getAddress has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func getAddress(base netip.Prefix, bitmask *bitmap.Bitmap, prefAddress netip.Addr, ipr netip.Prefix, serial bool) (netip.Addr, error) {
      Severity: Minor
      Found in libnetwork/ipams/defaultipam/allocator.go - About 35 mins to fix

        Method Allocator.getAddrSpace has 5 return statements (exceeds 4 allowed).
        Open

        func (a *Allocator) getAddrSpace(as string, v6 bool) (*addrSpace, error) {
            switch as {
            case localAddressSpace:
                if v6 {
                    return a.local6, nil
        Severity: Major
        Found in libnetwork/ipams/defaultipam/allocator.go - About 35 mins to fix

          Method Allocator.RequestAddress has 5 return statements (exceeds 4 allowed).
          Open

          func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) {
              log.G(context.TODO()).Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
              k, err := PoolIDFromString(poolID)
              if err != nil {
                  return nil, nil, types.InvalidParameterErrorf("invalid pool id: %s", poolID)
          Severity: Major
          Found in libnetwork/ipams/defaultipam/allocator.go - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status