dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method containerRouter.postContainersCreate has a Cognitive Complexity of 99 (exceeds 20 allowed). Consider refactoring.
Open

func (c *containerRouter) postContainersCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    if err := httputils.ParseForm(r); err != nil {
        return err
    }
    if err := httputils.CheckForJSON(r); err != nil {
Severity: Minor
Found in api/server/router/container/container_routes.go - About 1 day 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

File endpoint.go has 952 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
//go:build go1.21

package libnetwork

Severity: Major
Found in libnetwork/endpoint.go - About 1 day to fix

    Method NodeEvent.Unmarshal has a Cognitive Complexity of 92 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *NodeEvent) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Minor
    Found in libnetwork/networkdb/networkdb.pb.go - About 1 day 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 PartialLogEntryMetadata.Unmarshal has a Cognitive Complexity of 92 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *PartialLogEntryMetadata) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Minor
    Found in api/types/plugins/logdriver/entry.pb.go - About 1 day 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

    File container_operations.go has 926 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
    //go:build go1.21
    
    package daemon // import "github.com/docker/docker/daemon"
    
    
    Severity: Major
    Found in daemon/container_operations.go - About 1 day to fix

      Method EndpointRecord.Unmarshal has 325 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (m *EndpointRecord) Unmarshal(dAtA []byte) error {
          l := len(dAtA)
          iNdEx := 0
          for iNdEx < l {
              preIndex := iNdEx
      Severity: Major
      Found in libnetwork/agent.pb.go - About 1 day to fix

        File local_windows.go has 912 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package local // import "github.com/docker/docker/libcontainerd/local"
        
        // This package contains the legacy in-proc calls in HCS using the v1 schema
        // for Windows runtime purposes.
        
        
        Severity: Major
        Found in libcontainerd/local/local_windows.go - About 1 day to fix

          File oci_linux.go has 904 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          package daemon // import "github.com/docker/docker/daemon"
          
          import (
              "context"
              "fmt"
          Severity: Major
          Found in daemon/oci_linux.go - About 1 day to fix

            File network.go has 888 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package daemon // import "github.com/docker/docker/daemon"
            
            import (
                "context"
                "errors"
            Severity: Major
            Found in daemon/network.go - About 1 day to fix

              File pull_v2.go has 874 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              package distribution // import "github.com/docker/docker/distribution"
              
              import (
                  "context"
                  "encoding/json"
              Severity: Major
              Found in distribution/pull_v2.go - About 1 day to fix

                Function includeContainerInList has a Cognitive Complexity of 84 (exceeds 20 allowed). Consider refactoring.
                Open

                func includeContainerInList(container *container.Snapshot, filter *listContext) iterationAction {
                    // Do not include container if it's in the list before the filter container.
                    // Set the filter container to nil to include the rest of containers after this one.
                    if filter.beforeFilter != nil {
                        if container.ID == filter.beforeFilter.ID {
                Severity: Minor
                Found in daemon/list.go - About 1 day 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 setupSeccomp has a Cognitive Complexity of 82 (exceeds 20 allowed). Consider refactoring.
                Open

                func setupSeccomp(config *Seccomp, rs *specs.Spec) (*specs.LinuxSeccomp, error) {
                    if config == nil {
                        return nil, nil
                    }
                
                
                Severity: Minor
                Found in profiles/seccomp/seccomp_linux.go - About 1 day 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 LayerDownloadManager.makeDownloadFunc has a Cognitive Complexity of 82 (exceeds 20 allowed). Consider refactoring.
                Open

                func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, parentLayer layer.ChainID, parentDownload *downloadTransfer) doFunc {
                    return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) transfer {
                        d := &downloadTransfer{
                            transfer:   newTransfer(),
                            layerStore: ldm.layerStore,
                Severity: Minor
                Found in distribution/xfer/download.go - About 1 day 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 Controller.NewNetwork has a Cognitive Complexity of 80 (exceeds 20 allowed). Consider refactoring.
                Open

                func (c *Controller) NewNetwork(networkType, name string, id string, options ...NetworkOption) (_ *Network, retErr error) {
                    if id != "" {
                        c.networkLocker.Lock(id)
                        defer c.networkLocker.Unlock(id) //nolint:errcheck
                
                
                Severity: Minor
                Found in libnetwork/controller.go - About 1 day 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 skipOverlay has a Cognitive Complexity of 78 (exceeds 20 allowed). Consider refactoring.
                Open

                func skipOverlay(dAtA []byte) (n int, err error) {
                    l := len(dAtA)
                    iNdEx := 0
                    for iNdEx < l {
                        var wire uint64
                Severity: Minor
                Found in libnetwork/drivers/windows/overlay/overlay.pb.go - About 1 day 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

                File controller.go has 829 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                /*
                Package libnetwork provides the basic functionality and extension points to
                create network namespaces and allocate interfaces for containers to use.
                
                    networkType := "bridge"
                Severity: Major
                Found in libnetwork/controller.go - About 1 day to fix

                  File default_linux.go has 824 lines of code (exceeds 500 allowed). Consider refactoring.
                  Open

                  package seccomp // import "github.com/docker/docker/profiles/seccomp"
                  
                  import (
                      "github.com/opencontainers/runtime-spec/specs-go"
                      "golang.org/x/sys/unix"
                  Severity: Major
                  Found in profiles/seccomp/default_linux.go - About 1 day to fix

                    Method GossipMessage.Unmarshal has a Cognitive Complexity of 77 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (m *GossipMessage) Unmarshal(dAtA []byte) error {
                        l := len(dAtA)
                        iNdEx := 0
                        for iNdEx < l {
                            preIndex := iNdEx
                    Severity: Minor
                    Found in libnetwork/networkdb/networkdb.pb.go - About 1 day 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 TableEvent.Unmarshal has 266 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (m *TableEvent) Unmarshal(dAtA []byte) error {
                        l := len(dAtA)
                        iNdEx := 0
                        for iNdEx < l {
                            preIndex := iNdEx
                    Severity: Major
                    Found in libnetwork/networkdb/networkdb.pb.go - About 1 day to fix

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

                      func (daemon *Daemon) initNetworkController(daemonCfg *config.Config, activeSandboxes map[string]interface{}) error {
                          netOptions, err := daemon.networkOptions(daemonCfg, nil, daemon.id, nil)
                          if err != nil {
                              return err
                          }
                      Severity: Minor
                      Found in daemon/daemon_windows.go - About 1 day 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

                      Severity
                      Category
                      Status
                      Source
                      Language