docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Method UpdateVolumeStatusRequest_VolumeStatusUpdate.Unmarshal has 99 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    Method IssueNodeCertificateResponse.Unmarshal has 98 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (m *IssueNodeCertificateResponse) 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 SelectBySlot.Unmarshal has 98 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (m *SelectBySlot) 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 ResourceReference.Unmarshal has 98 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (m *ResourceReference) 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

          Method session.watch has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
          Open

          func (s *session) watch(ctx context.Context) error {
              logger := log.G(ctx).WithFields(log.Fields{"method": "(*session).watch"})
              logger.Debugf("")
              var (
                  resp            *api.AssignmentsMessage
          Severity: Minor
          Found in agent/session.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 Cluster.MarshalToSizedBuffer has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
          Open

          func (m *Cluster) MarshalToSizedBuffer(dAtA []byte) (int, error) {
              i := len(dAtA)
              _ = i
              var l int
              _ = l
          Severity: Minor
          Found in api/objects.pb.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 init has 97 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func init() {
              register(ObjectStoreConfig{
                  Table: &memdb.TableSchema{
                      Name: tableTask,
                      Indexes: map[string]*memdb.IndexSchema{
          Severity: Major
          Found in manager/state/store/tasks.go - About 2 hrs to fix

            Function NewStoreAction has 96 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func NewStoreAction(c Event) (StoreAction, error) {
                var sa StoreAction
                switch v := c.(type) {
                case EventCreateNode:
                    sa.Action = StoreActionKindCreate
            Severity: Major
            Found in api/objects.pb.go - About 2 hrs to fix

              Method Secret.Unmarshal has 32 return statements (exceeds 4 allowed).
              Open

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

                Method SubscriptionMessage.Unmarshal has 32 return statements (exceeds 4 allowed).
                Open

                func (m *SubscriptionMessage) 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 LogSubscriptionOptions.Unmarshal has 32 return statements (exceeds 4 allowed).
                  Open

                  func (m *LogSubscriptionOptions) 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 TaskSpec.MarshalToSizedBuffer has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

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

                      Method testSuite.TestServiceAddRemovePorts has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (suite *testSuite) TestServiceAddRemovePorts() {
                          s := store.NewMemoryStore(nil)
                          suite.NotNil(s)
                          defer s.Close()
                      
                      
                      Severity: Major
                      Found in manager/allocator/allocator_test_suite.go - About 2 hrs to fix

                        File testutils.go has 533 lines of code (exceeds 500 allowed). Consider refactoring.
                        Open

                        package testutils
                        
                        import (
                            "context"
                            "net"
                        Severity: Minor
                        Found in manager/state/raft/testutils/testutils.go - About 2 hrs to fix

                          Method ConstraintEnforcer.rejectNoncompliantTasks has 94 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (ce *ConstraintEnforcer) rejectNoncompliantTasks(node *api.Node) {
                              // If the availability is "drain", the orchestrator will
                              // shut down all tasks.
                              // If the availability is "pause", we shouldn't touch
                              // the tasks on this node.
                          Severity: Major
                          Found in manager/orchestrator/constraintenforcer/constraint_enforcer.go - About 2 hrs to fix

                            Method AssignmentsMessage.Unmarshal has 31 return statements (exceeds 4 allowed).
                            Open

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

                              Method RaftMember.Unmarshal has 31 return statements (exceeds 4 allowed).
                              Open

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

                                Method Updater.worker has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (u *Updater) worker(ctx context.Context, queue <-chan orchestrator.Slot, updateConfig *api.UpdateConfig) {
                                    for slot := range queue {
                                        // Do we have a task with the new spec in desired state = RUNNING?
                                        // If so, all we have to do to complete the update is remove the
                                        // other tasks. Or if we have a task with the new spec that has
                                Severity: Minor
                                Found in manager/orchestrator/update/updater.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 TLSRenewer.Start has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (t *TLSRenewer) Start(ctx context.Context) <-chan CertificateUpdate {
                                    updates := make(chan CertificateUpdate)
                                
                                    go func() {
                                        var (
                                Severity: Minor
                                Found in ca/renewer.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 validateCAConfig has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func validateCAConfig(ctx context.Context, securityConfig *ca.SecurityConfig, cluster *api.Cluster) (*api.RootCA, error) {
                                    newConfig := cluster.Spec.CAConfig.Copy()
                                    newConfig.SigningCACert = ca.NormalizePEMs(newConfig.SigningCACert) // ensure this is normalized before we use it
                                
                                    if len(newConfig.SigningCAKey) > 0 && len(newConfig.SigningCACert) == 0 {
                                Severity: Minor
                                Found in manager/controlapi/ca_rotation.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

                                Severity
                                Category
                                Status
                                Source
                                Language