asteris-llc/converge

View on GitHub
resource/docker/volume/volume_test.go

Summary

Maintainability
D
2 days
Test Coverage

Function TestVolumeApply has 107 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestVolumeApply(t *testing.T) {
    t.Parallel()
    defer logging.HideLogs(t)()

    t.Run("docker find volume error", func(t *testing.T) {
Severity: Major
Found in resource/docker/volume/volume_test.go - About 3 hrs to fix

    Function TestVolumeCheck has 103 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestVolumeCheck(t *testing.T) {
        t.Parallel()
        defer logging.HideLogs(t)()
    
        t.Run("state: absent", func(t *testing.T) {
    Severity: Major
    Found in resource/docker/volume/volume_test.go - About 3 hrs to fix

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

              t.Run("volume exists", func(t *testing.T) {
                  vol := &volume.Volume{
                      Name:  "test-volume",
                      State: "present",
                  }
      Severity: Major
      Found in resource/docker/volume/volume_test.go and 1 other location - About 2 hrs to fix
      resource/docker/volume/volume_test.go on lines 63..74

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

      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

              t.Run("volume exists", func(t *testing.T) {
                  vol := &volume.Volume{Name: "test-volume", State: "absent"}
                  c := &mockClient{}
                  vol.SetClient(c)
                  c.On("FindVolume", "test-volume").Return(&dc.Volume{Name: "test-volume"}, nil)
      Severity: Major
      Found in resource/docker/volume/volume_test.go and 1 other location - About 2 hrs to fix
      resource/docker/volume/volume_test.go on lines 94..108

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

      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

              t.Run("volume does not exist", func(t *testing.T) {
                  vol := &volume.Volume{
                      Name:  "test-volume",
                      State: "present",
                  }
      Severity: Major
      Found in resource/docker/volume/volume_test.go and 1 other location - About 2 hrs to fix
      resource/docker/volume/volume_test.go on lines 50..61

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

      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

              t.Run("volume does not exist", func(t *testing.T) {
                  vol := &volume.Volume{Name: "test-volume", State: "absent"}
                  c := &mockClient{}
                  vol.SetClient(c)
                  c.On("FindVolume", "test-volume").Return(nil, nil)
      Severity: Major
      Found in resource/docker/volume/volume_test.go and 1 other location - About 2 hrs to fix
      resource/docker/volume/volume_test.go on lines 78..92

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

      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 *mockClient) CreateVolume(opts dc.CreateVolumeOptions) (*dc.Volume, error) {
          args := m.Called(opts)
          ret := args.Get(0)
          if ret == nil {
              return nil, args.Error(1)
      Severity: Minor
      Found in resource/docker/volume/volume_test.go and 1 other location - About 45 mins to fix
      resource/docker/network/network_test.go on lines 526..533

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

      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 *mockClient) FindVolume(name string) (*dc.Volume, error) {
          args := m.Called(name)
      
          ret := args.Get(0)
          if ret == nil {
      Severity: Minor
      Found in resource/docker/volume/volume_test.go and 1 other location - About 40 mins to fix
      resource/docker/network/network_test.go on lines 517..524

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

      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

      Your code does not pass gofmt in 1 place. Go fmt your code!
      Open

      // Copyright © 2016 Asteris, LLC
      Severity: Minor
      Found in resource/docker/volume/volume_test.go by gofmt

      There are no issues that match your filters.

      Category
      Status