docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method WatchRequest_WatchEntry.Unmarshal has 132 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    Method NetworkAttachment.Unmarshal has 49 return statements (exceeds 4 allowed).
    Open

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (m *LogContext) MarshalToSizedBuffer(dAtA []byte) (int, error) {
          i := len(dAtA)
          _ = i
          var l int
          _ = l
      Severity: Major
      Found in api/logbroker.pb.go and 1 other location - About 4 hrs to fix
      api/watch.pb.go on lines 1626..1653

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 323.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (p *raftProxyRaftServer) StreamRaftMessage(stream Raft_StreamRaftMessageServer) error {
          ctx := stream.Context()
          conn, err := p.connSelector.LeaderConn(ctx)
          if err != nil {
              if err == raftselector.ErrIsLeader {
      Severity: Major
      Found in api/raft.pb.go and 1 other location - About 4 hrs to fix
      api/logbroker.pb.go on lines 1971..2017

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 323.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (p *raftProxyLogBrokerServer) PublishLogs(stream LogBroker_PublishLogsServer) error {
          ctx := stream.Context()
          conn, err := p.connSelector.LeaderConn(ctx)
          if err != nil {
              if err == raftselector.ErrIsLeader {
      Severity: Major
      Found in api/logbroker.pb.go and 1 other location - About 4 hrs to fix
      api/raft.pb.go on lines 2202..2248

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 323.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (m *SelectByCustom) MarshalToSizedBuffer(dAtA []byte) (int, error) {
          i := len(dAtA)
          _ = i
          var l int
          _ = l
      Severity: Major
      Found in api/watch.pb.go and 1 other location - About 4 hrs to fix
      api/logbroker.pb.go on lines 1319..1346

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 323.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method Cluster.MarshalToSizedBuffer has 130 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

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

        Method NetworkSpec.Unmarshal has 48 return statements (exceeds 4 allowed).
        Open

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

          Method WatchSelectors.Unmarshal has 48 return statements (exceeds 4 allowed).
          Open

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

            Method taskManager.run has 129 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (tm *taskManager) run(ctx context.Context) {
                ctx, cancelAll := context.WithCancel(ctx)
                defer cancelAll() // cancel all child operations on exit.
            
                ctx = log.WithModule(ctx, "taskmanager")
            Severity: Major
            Found in agent/task.go - About 4 hrs to fix

              Function printServiceSummary has 129 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func printServiceSummary(service *api.Service, running int) {
                  w := tabwriter.NewWriter(os.Stdout, 8, 8, 8, ' ', 0)
                  defer w.Flush()
              
                  task := service.Spec.Task
              Severity: Major
              Found in swarmd/cmd/swarmctl/service/inspect.go - About 4 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                func watchNetwork(t *testing.T, watch chan events.Event, expectTimeout bool, fn func(t assert.TestingT, n *api.Network) bool) {
                    for {
                        var network *api.Network
                        select {
                        case event := <-watch:
                Severity: Major
                Found in manager/allocator/allocator_test_suite.go and 1 other location - About 4 hrs to fix
                manager/allocator/allocator_test_suite.go on lines 2145..2176

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 318.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                func watchService(t *testing.T, watch chan events.Event, expectTimeout bool, fn func(t assert.TestingT, n *api.Service) bool) {
                    for {
                        var service *api.Service
                        select {
                        case event := <-watch:
                Severity: Major
                Found in manager/allocator/allocator_test_suite.go and 1 other location - About 4 hrs to fix
                manager/allocator/allocator_test_suite.go on lines 2112..2143

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 318.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method nodeSet.tree has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
                Open

                func (ns *nodeSet) tree(serviceID string, preferences []*api.PlacementPreference, maxAssignments int, meetsConstraints func(*NodeInfo) bool, nodeLess func(*NodeInfo, *NodeInfo) bool) decisionTree {
                    var root decisionTree
                
                    if maxAssignments == 0 {
                        return root
                Severity: Minor
                Found in manager/scheduler/nodeset.go - About 4 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 Dispatcher.processUpdates has 127 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (d *Dispatcher) processUpdates(ctx context.Context) {
                    var (
                        taskUpdates        map[string]*api.TaskStatus
                        nodeUpdates        map[string]nodeUpdate
                        unpublishedVolumes map[string][]string
                Severity: Major
                Found in manager/dispatcher/dispatcher.go - About 4 hrs to fix

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      suite.NoError(s.Update(func(tx store.Tx) error {
                          // populate ingress network
                          in := &api.Network{
                              ID: "ingress-nw-id",
                              Spec: api.NetworkSpec{
                  Severity: Major
                  Found in manager/allocator/allocator_test_suite.go and 1 other location - About 4 hrs to fix
                  manager/allocator/allocator_test_suite.go on lines 1918..1965

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 313.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          suite.NoError(s.Update(func(tx store.Tx) error {
                              // populate ingress network
                              in := &api.Network{
                                  ID: "ingress-nw-id",
                                  Spec: api.NetworkSpec{
                  Severity: Major
                  Found in manager/allocator/allocator_test_suite.go and 1 other location - About 4 hrs to fix
                  manager/allocator/allocator_test_suite.go on lines 1835..1882

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 313.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Method Network.Unmarshal has 46 return statements (exceeds 4 allowed).
                  Open

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

                    Method Volume.Unmarshal has 46 return statements (exceeds 4 allowed).
                    Open

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

                      Method Dispatcher.Session has 125 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (d *Dispatcher) Session(r *api.SessionRequest, stream api.Dispatcher_SessionServer) error {
                          d.rpcRW.RLock()
                          defer d.rpcRW.RUnlock()
                      
                          dctx, err := d.isRunningLocked()
                      Severity: Major
                      Found in manager/dispatcher/dispatcher.go - About 4 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language