docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Resource has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

type Resource struct {
    ID          string      `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
    Meta        Meta        `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
    Annotations Annotations `protobuf:"bytes,3,opt,name=annotations,proto3" json:"annotations"`
    // Kind identifies this class of object. It is essentially a namespace
Severity: Minor
Found in api/objects.pb.go - About 2 hrs to fix

    Task has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type Task struct {
        ID   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
        Meta Meta   `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
        // Spec defines the desired state of the task as specified by the user.
        // The system will honor this and will *never* modify it.
    Severity: Minor
    Found in api/objects.pb.go - About 2 hrs to fix

      Service has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type Service struct {
          ID   string      `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
          Meta Meta        `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
          Spec ServiceSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"`
          // SpecVersion versions Spec, to identify changes in the spec. Note that
      Severity: Minor
      Found in api/objects.pb.go - About 2 hrs to fix

        Config has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type Config struct {
            ID   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
            Meta Meta   `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
            // Spec contains the actual config data, as well as any context around the
            // config data that the user provides.
        Severity: Minor
        Found in api/objects.pb.go - About 2 hrs to fix

          Node has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type Node struct {
              // ID specifies the identity of the node.
              ID   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
              Meta Meta   `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
              // Spec defines the desired state of the node as specified by the user.
          Severity: Minor
          Found in api/objects.pb.go - About 2 hrs to fix

            Extension has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type Extension struct {
                ID          string      `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
                Meta        Meta        `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
                Annotations Annotations `protobuf:"bytes,3,opt,name=annotations,proto3" json:"annotations"`
                Description string      `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
            Severity: Minor
            Found in api/objects.pb.go - About 2 hrs to fix

              Secret has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type Secret struct {
                  ID   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
                  Meta Meta   `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
                  // Spec contains the actual secret data, as well as any context around the
                  // secret data that the user provides.
              Severity: Minor
              Found in api/objects.pb.go - About 2 hrs to fix

                Cluster has 23 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type Cluster struct {
                    ID   string      `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
                    Meta Meta        `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
                    Spec ClusterSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"`
                    // RootCA contains key material for the root CA.
                Severity: Minor
                Found in api/objects.pb.go - About 2 hrs to fix

                  Network has 23 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type Network struct {
                      ID   string      `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
                      Meta Meta        `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
                      Spec NetworkSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"`
                      // Driver specific operational state provided by the network driver.
                  Severity: Minor
                  Found in api/objects.pb.go - About 2 hrs to fix

                    Volume has 23 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type Volume struct {
                        // ID is the swarmkit-internal ID for this volume object. This has no
                        // relation to the CSI volume identifier provided by the CSI Plugin.
                        ID   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
                        Meta Meta   `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
                    Severity: Minor
                    Found in api/objects.pb.go - About 2 hrs to fix

                      Function parseResource has 87 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func parseResource(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
                          if flags.Changed("memory-reservation") {
                              if spec.Task.Resources == nil {
                                  spec.Task.Resources = &api.ResourceRequirements{}
                              }
                      Severity: Major
                      Found in swarmd/cmd/swarmctl/service/flagparser/resource.go - About 2 hrs to fix

                        Function printNodeSummary has 86 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func printNodeSummary(node *api.Node) {
                            w := tabwriter.NewWriter(os.Stdout, 8, 8, 8, ' ', 0)
                            defer func() {
                                // Ignore flushing errors - there's nothing we can do.
                                _ = w.Flush()
                        Severity: Major
                        Found in swarmd/cmd/swarmctl/node/inspect.go - About 2 hrs to fix

                          Function NodeMatches has 86 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func NodeMatches(constraints []Constraint, n *api.Node) bool {
                              for _, constraint := range constraints {
                                  switch {
                                  case strings.EqualFold(constraint.key, "node.id"):
                                      if !constraint.Match(n.ID) {
                          Severity: Major
                          Found in manager/constraint/constraint.go - About 2 hrs to fix

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

                            func printNetworkSummary(network *api.Network) {
                                w := tabwriter.NewWriter(os.Stdout, 8, 8, 8, ' ', 0)
                                defer func() {
                                    // Ignore flushing errors - there's nothing we can do.
                                    _ = w.Flush()
                            Severity: Minor
                            Found in swarmd/cmd/swarmctl/network/inspect.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 worker.Subscribe has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (w *worker) Subscribe(ctx context.Context, subscription *api.SubscriptionMessage) error {
                                log.G(ctx).Debugf("Received subscription %s (selector: %v)", subscription.ID, subscription.Selector)
                            
                                publisher, cancel, err := w.publisherProvider.Publisher(ctx, subscription.ID)
                                if err != nil {
                            Severity: Minor
                            Found in agent/worker.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 IssueNodeCertificateRequest.Unmarshal has 27 return statements (exceeds 4 allowed).
                            Open

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

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

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

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

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

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

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

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

                                    func (m *ContainerSpec_DNSConfig) Unmarshal(dAtA []byte) error {
                                        l := len(dAtA)
                                        iNdEx := 0
                                        for iNdEx < l {
                                            preIndex := iNdEx
                                    Severity: Major
                                    Found in api/specs.pb.go - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language