dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Function newProxy has 11 return statements (exceeds 4 allowed).
Open

func newProxy(config ProxyConfig) (p Proxy, err error) {
    ipv := ip4
    if config.HostIP.To4() == nil {
        ipv = ip6
    }
Severity: Major
Found in cmd/docker-proxy/main_linux.go - About 1 hr to fix

    Method driver.DeleteNetwork has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
    Open

    func (d *driver) DeleteNetwork(nid string) error {
        n := d.network(nid)
        if n == nil {
            return fmt.Errorf("network id %s not found", nid)
        }
    Severity: Minor
    Found in libnetwork/drivers/ipvlan/ipvlan_network.go - About 1 hr 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 cnmNetworkAllocator.allocatePools has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
    Open

    func (na *cnmNetworkAllocator) allocatePools(n *api.Network) (map[string]string, error) {
        ipam, dName, dOptions, err := na.resolveIPAM(n)
        if err != nil {
            return nil, err
        }
    Severity: Minor
    Found in libnetwork/cnmallocator/networkallocator.go - About 1 hr 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 Service.Search has a Cognitive Complexity of 25 (exceeds 20 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) {
        if err := searchFilters.Validate(acceptedSearchFilterTags); err != nil {
            return nil, err
        }
    
    
    Severity: Minor
    Found in registry/search.go - About 1 hr 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.processEventStream has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
    Open

    func (c *client) processEventStream(ctx context.Context, ns string) {
        // Create a new context specifically for this subscription.
        // The context must be cancelled to cancel the subscription.
        // In cases where we have to restart event stream processing,
        //   we'll need the original context b/c this one will be cancelled
    Severity: Minor
    Found in libcontainerd/remote/client.go - About 1 hr 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 skipPlugin has 11 return statements (exceeds 4 allowed).
    Open

    func skipPlugin(dAtA []byte) (n int, err error) {
        l := len(dAtA)
        iNdEx := 0
        depth := 0
        for iNdEx < l {
    Severity: Major
    Found in api/types/swarm/runtime/plugin.pb.go - About 1 hr to fix

      Function skipEntry has 11 return statements (exceeds 4 allowed).
      Open

      func skipEntry(dAtA []byte) (n int, err error) {
          l := len(dAtA)
          iNdEx := 0
          depth := 0
          for iNdEx < l {
      Severity: Major
      Found in api/types/plugins/logdriver/entry.pb.go - About 1 hr to fix

        Method Cluster.GetServices has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
        Open

        func (c *Cluster) GetServices(options types.ServiceListOptions) ([]swarm.Service, error) {
            c.mu.RLock()
            defer c.mu.RUnlock()
        
            state := c.currentNodeState()
        Severity: Minor
        Found in daemon/cluster/services.go - About 1 hr 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 follow.Do has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
        Open

        func (fl *follow) Do(ctx context.Context, f *os.File, read logPos) {
            fl.log = log.G(ctx).WithFields(log.Fields{
                "module": "logger",
                "file":   f.Name(),
            })
        Severity: Minor
        Found in daemon/logger/loggerutils/follow.go - About 1 hr 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 ServiceSpecToGRPC has 11 return statements (exceeds 4 allowed).
        Open

        func ServiceSpecToGRPC(s types.ServiceSpec) (swarmapi.ServiceSpec, error) {
            name := s.Name
            if name == "" {
                name = namesgenerator.GetRandomName(0)
            }
        Severity: Major
        Found in daemon/cluster/convert/service.go - About 1 hr to fix

          Method Daemon.ContainerStats has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) ContainerStats(ctx context.Context, prefixOrName string, config *backend.ContainerStatsConfig) error {
              ctr, err := daemon.GetContainer(prefixOrName)
              if err != nil {
                  return err
              }
          Severity: Minor
          Found in daemon/stats.go - About 1 hr 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 splunkLogger.tryPostMessages has 11 return statements (exceeds 4 allowed).
          Open

          func (l *splunkLogger) tryPostMessages(ctx context.Context, messages []*splunkMessage) error {
              if len(messages) == 0 {
                  return nil
              }
              var buffer bytes.Buffer
          Severity: Major
          Found in daemon/logger/splunk/splunk.go - About 1 hr to fix

            Method pluginAdapterWithRead.ReadLogs has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
            Open

            func (a *pluginAdapterWithRead) ReadLogs(ctx context.Context, config ReadConfig) *LogWatcher {
                watcher := NewLogWatcher()
            
                go func() {
                    defer close(watcher.Msg)
            Severity: Minor
            Found in daemon/logger/adapter.go - About 1 hr 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 ImageService.ImageDelete has 11 return statements (exceeds 4 allowed).
            Open

            func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetypes.DeleteResponse, error) {
                start := time.Now()
                records := []imagetypes.DeleteResponse{}
            
                img, err := i.GetImage(ctx, imageRef, backend.GetImageOpts{})
            Severity: Major
            Found in daemon/images/image_delete.go - About 1 hr to fix

              Function setResourcesInSpec has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
              Open

              func setResourcesInSpec(c *container.Container, s *specs.Spec, isHyperV bool) {
                  // In s.Windows.Resources
                  cpuShares := uint16(c.HostConfig.CPUShares)
                  cpuMaximum := uint16(c.HostConfig.CPUPercent) * 100
                  cpuCount := uint64(c.HostConfig.CPUCount)
              Severity: Minor
              Found in daemon/oci_windows.go - About 1 hr 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 ImageService.GetImage has 11 return statements (exceeds 4 allowed).
              Open

              func (i *ImageService) GetImage(ctx context.Context, refOrID string, options backend.GetImageOpts) (retImg *image.Image, retErr error) {
                  defer func() {
                      if retErr != nil || retImg == nil || options.Platform == nil {
                          return
                      }
              Severity: Major
              Found in daemon/images/image.go - About 1 hr to fix

                Function FrozenImagesLinux has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                Open

                func FrozenImagesLinux(ctx context.Context, client client.APIClient, images ...string) error {
                    ctx, span := otel.Tracer("").Start(ctx, "LoadFrozenImages")
                    defer span.End()
                
                    var loadImages []struct{ srcName, destName string }
                Severity: Minor
                Found in testutil/fixtures/load/frozen.go - About 1 hr 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.UnmarshalJSON has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (ncfg *networkConfiguration) UnmarshalJSON(b []byte) error {
                    var (
                        err  error
                        nMap map[string]interface{}
                    )
                Severity: Minor
                Found in libnetwork/drivers/bridge/bridge_store.go - About 1 hr to fix

                  Function installCommonConfigFlags has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
                      var (
                          allowNonDistributable = opts.NewNamedListOptsRef("allow-nondistributable-artifacts", &conf.AllowNondistributableArtifacts, registry.ValidateIndexName)
                          registryMirrors       = opts.NewNamedListOptsRef("registry-mirrors", &conf.Mirrors, registry.ValidateMirror)
                          insecureRegistries    = opts.NewNamedListOptsRef("insecure-registries", &conf.InsecureRegistries, registry.ValidateIndexName)
                  Severity: Minor
                  Found in cmd/dockerd/config.go - About 1 hr to fix

                    Method imageRouter.getImagesJSON has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (ir *imageRouter) getImagesJSON(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                        if err := httputils.ParseForm(r); err != nil {
                            return err
                        }
                    
                    
                    Severity: Minor
                    Found in api/server/router/image/image_routes.go - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language