dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method PeerRecord.Unmarshal has 27 return statements (exceeds 4 allowed).
Open

func (m *PeerRecord) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in libnetwork/drivers/overlay/overlay.pb.go - About 2 hrs to fix

    Function newImageBuildOptions has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
    Open

    func newImageBuildOptions(ctx context.Context, r *http.Request) (*types.ImageBuildOptions, error) {
        options := &types.ImageBuildOptions{
            Version:        types.BuilderV1, // Builder V1 is the default, but can be overridden
            Dockerfile:     r.FormValue("dockerfile"),
            SuppressOutput: httputils.BoolValue(r, "q"),
    Severity: Minor
    Found in api/server/router/build/build_routes.go - About 2 hrs 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 PluginPrivilege.Unmarshal has 27 return statements (exceeds 4 allowed).
    Open

    func (m *PluginPrivilege) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Major
    Found in api/types/swarm/runtime/plugin.pb.go - About 2 hrs to fix

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

      func (c *Cluster) GetTasks(options apitypes.TaskListOptions) ([]types.Task, error) {
          var r *swarmapi.ListTasksResponse
      
          err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
              filterTransform := func(filter filters.Args) error {
      Severity: Minor
      Found in daemon/cluster/tasks.go - About 2 hrs 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 DisplayJSONMessagesStream has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
      Open

      func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
          var (
              dec = json.NewDecoder(in)
              ids = make(map[string]uint)
          )
      Severity: Minor
      Found in pkg/jsonmessage/jsonmessage.go - About 2 hrs 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 Parse has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
      Open

      func Parse(filePath string, objName string) (*ParsedPkg, error) {
          fs := token.NewFileSet()
          pkg, err := parser.ParseFile(fs, filePath, nil, parser.AllErrors)
          if err != nil {
              return nil, err
      Severity: Minor
      Found in pkg/plugins/pluginrpc-gen/parser.go - About 2 hrs 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 resolver.go has 516 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package libnetwork
      
      import (
          "context"
          "errors"
      Severity: Minor
      Found in libnetwork/resolver.go - About 2 hrs to fix

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

        package container // import "github.com/docker/docker/daemon/cluster/executor/container"
        
        import (
            "context"
            "fmt"
        Severity: Minor
        Found in daemon/cluster/executor/container/controller.go - About 2 hrs to fix

          Function parseConfig has 84 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func parseConfig(cfg map[string]string) (fluent.Config, error) {
              var config fluent.Config
          
              loc, err := parseAddress(cfg[addressKey])
              if err != nil {
          Severity: Major
          Found in daemon/logger/fluentd/fluentd.go - About 2 hrs to fix

            Plugin has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type Plugin struct {
                mu        sync.RWMutex
                PluginObj types.Plugin `json:"plugin"` // todo: embed struct
                pClient   *plugins.Client
                refCount  int
            Severity: Minor
            Found in plugin/v2/plugin.go - About 2 hrs to fix

              TableEvent has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type TableEvent struct {
                  Type TableEvent_Type `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.TableEvent_Type" json:"type,omitempty"`
                  // Lamport time when this event was generated.
                  LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"`
                  // Node name where this event originated.
              Severity: Minor
              Found in libnetwork/networkdb/networkdb.pb.go - About 2 hrs to fix

                containerRouter has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                func (c *containerRouter) postCommit(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/container/container_routes.go - About 2 hrs to fix

                  Method tarexporter.legacyLoadImage has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (l *tarexporter) legacyLoadImage(oldID, sourceDir string, loadedMap map[string]image.ID, progressOutput progress.Output) error {
                      if _, loaded := loadedMap[oldID]; loaded {
                          return nil
                      }
                      configPath, err := safePath(sourceDir, filepath.Join(oldID, legacyConfigFileName))
                  Severity: Major
                  Found in image/tarexport/load.go - About 2 hrs to fix

                    Method EndpointRecord.MarshalToSizedBuffer has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (m *EndpointRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                        i := len(dAtA)
                        _ = i
                        var l int
                        _ = l
                    Severity: Major
                    Found in libnetwork/agent.pb.go - About 2 hrs to fix

                      Method driver.Join has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                      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.macvlan.Join", trace.WithAttributes(
                              attribute.String("nid", nid),
                              attribute.String("eid", eid),
                              attribute.String("sboxKey", sboxKey)))
                      Severity: Major
                      Found in libnetwork/drivers/macvlan/macvlan_joinleave.go - About 2 hrs to fix

                        Method systemRouter.getDiskUsage has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                            if err := httputils.ParseForm(r); err != nil {
                                return err
                            }
                        
                        
                        Severity: Major
                        Found in api/server/router/system/system_routes.go - About 2 hrs to fix

                          Method executor.Configure has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (e *executor) Configure(ctx context.Context, node *api.Node) error {
                              var ingressNA *api.NetworkAttachment
                              attachments := make(map[string]string)
                          
                              for _, na := range node.Attachments {
                          Severity: Major
                          Found in daemon/cluster/executor/container/executor.go - About 2 hrs to fix

                            Method ImageService.ImageDelete has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                            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 2 hrs to fix

                              File services.go has 511 lines of code (exceeds 500 allowed). Consider refactoring.
                              Open

                              package cluster // import "github.com/docker/docker/daemon/cluster"
                              
                              import (
                                  "context"
                                  "encoding/base64"
                              Severity: Minor
                              Found in daemon/cluster/services.go - About 2 hrs to fix

                                File swarm.go has 511 lines of code (exceeds 500 allowed). Consider refactoring.
                                Open

                                package cluster // import "github.com/docker/docker/daemon/cluster"
                                
                                import (
                                    "context"
                                    "fmt"
                                Severity: Minor
                                Found in daemon/cluster/swarm.go - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language