docker/swarmkit

View on GitHub
manager/allocator/allocator_test_suite.go

Summary

Maintainability
F
2 wks
Test Coverage

File allocator_test_suite.go has 1845 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package allocator

import (
    "context"
    "net"
Severity: Major
Found in manager/allocator/allocator_test_suite.go - About 4 days to fix

    Method testSuite.TestAllocator has 469 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      Method testSuite.TestAllocatorRestoreForUnallocatedNetwork has 173 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (suite *testSuite) TestAllocatorRestoreForUnallocatedNetwork() {
          s := store.NewMemoryStore(nil)
          suite.NotNil(s)
          defer s.Close()
          // Create 3 services with 1 task each
      Severity: Major
      Found in manager/allocator/allocator_test_suite.go - About 5 hrs to fix

        Method testSuite.TestNodeAllocator has 168 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method testSuite.TestAllocatorRestartNoEndpointSpec has 124 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (suite *testSuite) TestAllocatorRestartNoEndpointSpec() {
              s := store.NewMemoryStore(nil)
              suite.NotNil(s)
              defer s.Close()
              // Create 3 services with 1 task each
          Severity: Major
          Found in manager/allocator/allocator_test_suite.go - About 3 hrs to fix

            Method testSuite.TestAllocatorRestoreForDuplicateIPs has 116 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (suite *testSuite) TestAllocatorRestoreForDuplicateIPs() {
                s := store.NewMemoryStore(nil)
                suite.NotNil(s)
                defer s.Close()
                // Create 3 services with 1 task each
            Severity: Major
            Found in manager/allocator/allocator_test_suite.go - About 3 hrs to fix

              Method testSuite.TestNoDuplicateIPs has 109 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (suite *testSuite) TestNoDuplicateIPs() {
                  s := store.NewMemoryStore(nil)
                  suite.NotNil(s)
                  defer s.Close()
              
              
              Severity: Major
              Found in manager/allocator/allocator_test_suite.go - About 3 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

                  Method testSuite.TestAllocator has 22 return statements (exceeds 4 allowed).
                  Open

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

                    Method testSuite.TestNodeAttachmentOnLeadershipChange has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (suite *testSuite) TestNodeAttachmentOnLeadershipChange() {
                        s := store.NewMemoryStore(nil)
                        suite.NotNil(s)
                        defer s.Close()
                    
                    
                    Severity: Minor
                    Found in manager/allocator/allocator_test_suite.go - About 1 hr to fix

                      Method testSuite.TestAllocateServiceConflictingUserDefinedPorts has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (suite *testSuite) TestAllocateServiceConflictingUserDefinedPorts() {
                          s := store.NewMemoryStore(nil)
                          suite.NotNil(s)
                          defer s.Close()
                      
                      
                      Severity: Minor
                      Found in manager/allocator/allocator_test_suite.go - About 1 hr to fix

                        Method testSuite.TestServiceUpdatePort has 70 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (suite *testSuite) TestServiceUpdatePort() {
                            s := store.NewMemoryStore(nil)
                            suite.NotNil(s)
                            defer s.Close()
                        
                        
                        Severity: Minor
                        Found in manager/allocator/allocator_test_suite.go - About 1 hr to fix

                          Function watchTask has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func watchTask(t *testing.T, s *store.MemoryStore, watch chan events.Event, expectTimeout bool, fn func(t assert.TestingT, s *store.MemoryStore, n *api.Task) bool) {
                              for {
                                  var task *api.Task
                                  select {
                                  case event := <-watch:
                          Severity: Minor
                          Found in manager/allocator/allocator_test_suite.go - About 1 hr 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 watchNetwork has a Cognitive Complexity of 29 (exceeds 20 allowed). 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: Minor
                          Found in manager/allocator/allocator_test_suite.go - About 1 hr 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 watchNode has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func watchNode(t *testing.T, watch chan events.Event, expectTimeout bool,
                              fn func(t assert.TestingT, originalNode, updatedNode *api.Node, networks []string) bool,
                              originalNode *api.Node,
                              networks []string) {
                              for {
                          Severity: Minor
                          Found in manager/allocator/allocator_test_suite.go - About 1 hr 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 watchService has a Cognitive Complexity of 29 (exceeds 20 allowed). 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: Minor
                          Found in manager/allocator/allocator_test_suite.go - About 1 hr 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 testSuite.TestServicePortAllocationIsRepeatable has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (suite *testSuite) TestServicePortAllocationIsRepeatable() {
                              alloc := func() []*api.PortConfig {
                                  s := store.NewMemoryStore(nil)
                                  suite.NotNil(s)
                                  defer s.Close()
                          Severity: Minor
                          Found in manager/allocator/allocator_test_suite.go - About 1 hr to fix

                            Method testSuite.TestDeallocateServiceAllocate has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (suite *testSuite) TestDeallocateServiceAllocate() {
                                s := store.NewMemoryStore(nil)
                                suite.NotNil(s)
                                defer s.Close()
                            
                            
                            Severity: Minor
                            Found in manager/allocator/allocator_test_suite.go - About 1 hr to fix

                              Method testSuite.TestNodeAllocator has 10 return statements (exceeds 4 allowed).
                              Open

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

                                Function watchNode has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                func watchNode(t *testing.T, watch chan events.Event, expectTimeout bool,
                                    fn func(t assert.TestingT, originalNode, updatedNode *api.Node, networks []string) bool,
                                    originalNode *api.Node,
                                    networks []string) {
                                Severity: Minor
                                Found in manager/allocator/allocator_test_suite.go - About 45 mins to fix

                                  Function watchTask has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func watchTask(t *testing.T, s *store.MemoryStore, watch chan events.Event, expectTimeout bool, fn func(t assert.TestingT, s *store.MemoryStore, n *api.Task) bool) {
                                  Severity: Minor
                                  Found in manager/allocator/allocator_test_suite.go - About 35 mins to fix

                                    Method testSuite.TestServiceUpdatePort has 5 return statements (exceeds 4 allowed).
                                    Open

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

                                      Method testSuite.TestAllocateServiceConflictingUserDefinedPorts has 5 return statements (exceeds 4 allowed).
                                      Open

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

                                        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

                                        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

                                        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

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

                                            hasNoIPOverlapTasks := func(fakeT assert.TestingT, s *store.MemoryStore, task *api.Task) bool {
                                                assert.NotEqual(fakeT, len(task.Networks), 0)
                                                assert.NotEqual(fakeT, len(task.Networks[0].Addresses), 0)
                                                assignedIP := task.Networks[1].Addresses[0]
                                                if assignedIPs[assignedIP] {
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 2 hrs to fix
                                        manager/allocator/allocator_test_suite.go on lines 981..994

                                        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 215.

                                        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

                                            hasNoIPOverlapTasks := func(fakeT assert.TestingT, s *store.MemoryStore, task *api.Task) bool {
                                                assert.NotEqual(fakeT, len(task.Networks), 0)
                                                assert.NotEqual(fakeT, len(task.Networks[0].Addresses), 0)
                                                assignedIP := task.Networks[0].Addresses[0]
                                                if assignedIPs[assignedIP] {
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 2 hrs to fix
                                        manager/allocator/allocator_test_suite.go on lines 1179..1192

                                        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 215.

                                        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

                                            hasNoIPOverlapServices := func(fakeT assert.TestingT, service *api.Service) bool {
                                                assert.NotEqual(fakeT, len(service.Endpoint.VirtualIPs), 0)
                                                assert.NotEqual(fakeT, len(service.Endpoint.VirtualIPs[0].Addr), 0)
                                                assignedVIP := service.Endpoint.VirtualIPs[1].Addr
                                                if assignedIPs[assignedVIP] {
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 2 hrs to fix
                                        manager/allocator/allocator_test_suite.go on lines 966..979

                                        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 212.

                                        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

                                            hasNoIPOverlapServices := func(fakeT assert.TestingT, service *api.Service) bool {
                                                assert.NotEqual(fakeT, len(service.Endpoint.VirtualIPs), 0)
                                                assert.NotEqual(fakeT, len(service.Endpoint.VirtualIPs[0].Addr), 0)
                                                assignedVIP := service.Endpoint.VirtualIPs[0].Addr
                                                if assignedIPs[assignedVIP] {
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 2 hrs to fix
                                        manager/allocator/allocator_test_suite.go on lines 1164..1177

                                        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 212.

                                        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

                                            suite.NoError(s.Update(func(tx store.Tx) error {
                                                t6 := &api.Task{
                                                    ID: "testTaskID6",
                                                    Status: api.TaskStatus{
                                                        State: api.TaskStateNew,
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 1 hr to fix
                                        manager/allocator/allocator_test_suite.go on lines 369..384

                                        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 137.

                                        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

                                            suite.NoError(s.Update(func(tx store.Tx) error {
                                                t3 := &api.Task{
                                                    ID: "testTaskID3",
                                                    Status: api.TaskStatus{
                                                        State: api.TaskStateNew,
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 1 hr to fix
                                        manager/allocator/allocator_test_suite.go on lines 515..530

                                        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 137.

                                        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 3 locations. Consider refactoring.
                                        Open

                                            suite.NoError(s.Update(func(tx store.Tx) error {
                                                // create a task assigned to this node that has a network attachment on
                                                // n1
                                                t1 := &api.Task{
                                                    ID:           "task1",
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 55 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 1329..1346
                                        manager/allocator/allocator_test_suite.go on lines 1356..1373

                                        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 126.

                                        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 3 locations. Consider refactoring.
                                        Open

                                            suite.NoError(s.Update(func(tx store.Tx) error {
                                                // create a task assigned to this node that has a network attachment on
                                                // n1
                                                t2 := &api.Task{
                                                    ID:           "task2",
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 55 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 1271..1288
                                        manager/allocator/allocator_test_suite.go on lines 1356..1373

                                        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 126.

                                        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 3 locations. Consider refactoring.
                                        Open

                                            suite.NoError(s.Update(func(tx store.Tx) error {
                                                // create a task assigned to this node that has a network attachment on
                                                // n1
                                                t3 := &api.Task{
                                                    ID:           "task3",
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 55 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 1271..1288
                                        manager/allocator/allocator_test_suite.go on lines 1329..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 126.

                                        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

                                            suite.NoError(s.Update(func(tx store.Tx) error {
                                                t2 := &api.Task{
                                                    ID: "testTaskID2",
                                                    Status: api.TaskStatus{
                                                        State: api.TaskStateNew,
                                        Severity: Minor
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 50 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 582..593

                                        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 119.

                                        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

                                            suite.NoError(s.Update(func(tx store.Tx) error {
                                                t7 := &api.Task{
                                                    ID: "testTaskID7",
                                                    Status: api.TaskStatus{
                                                        State: api.TaskStateNew,
                                        Severity: Minor
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 50 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 344..355

                                        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 119.

                                        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 3 locations. Consider refactoring.
                                        Open

                                                n1 = &api.Network{
                                                    ID: "testID1",
                                                    Spec: api.NetworkSpec{
                                                        Annotations: api.Annotations{
                                                            Name: "test1",
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 45 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 633..650
                                        manager/allocator/allocator_test_suite.go on lines 880..897

                                        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 116.

                                        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 3 locations. Consider refactoring.
                                        Open

                                                n1 := &api.Network{
                                                    ID: "testID1",
                                                    Spec: api.NetworkSpec{
                                                        Annotations: api.Annotations{
                                                            Name: "test1",
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 45 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 880..897
                                        manager/allocator/allocator_test_suite.go on lines 1049..1066

                                        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 116.

                                        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 3 locations. Consider refactoring.
                                        Open

                                                in := &api.Network{
                                                    ID: "overlay1",
                                                    Spec: api.NetworkSpec{
                                                        Annotations: api.Annotations{
                                                            Name: "net1",
                                        Severity: Major
                                        Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 45 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 633..650
                                        manager/allocator/allocator_test_suite.go on lines 1049..1066

                                        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 116.

                                        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

                                                sp1 := &api.Service{
                                                    ID: "predServiceID1",
                                                    Spec: api.ServiceSpec{
                                                        Annotations: api.Annotations{
                                                            Name: "predService1",
                                        Severity: Minor
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 40 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 214..229

                                        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 110.

                                        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

                                                sp2 := &api.Service{
                                                    ID: "predServiceID2",
                                                    Spec: api.ServiceSpec{
                                                        Annotations: api.Annotations{
                                                            Name: "predService2",
                                        Severity: Minor
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 40 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 180..195

                                        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 110.

                                        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

                                                in := &api.Network{
                                                    ID: "ingress-nw-id",
                                                    Spec: api.NetworkSpec{
                                                        Annotations: api.Annotations{
                                                            Name: "default-ingress",
                                        Severity: Minor
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 40 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 1029..1046

                                        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 108.

                                        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

                                                in := &api.Network{
                                                    ID: "ingress-nw-id",
                                                    Spec: api.NetworkSpec{
                                                        Annotations: api.Annotations{
                                                            Name: "default-ingress",
                                        Severity: Minor
                                        Found in manager/allocator/allocator_test_suite.go and 1 other location - About 40 mins to fix
                                        manager/allocator/allocator_test_suite.go on lines 743..760

                                        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 108.

                                        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

                                        There are no issues that match your filters.

                                        Category
                                        Status