asteris-llc/converge

View on GitHub

Showing 615 of 615 total issues

Function dependencyWalk has 127 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func dependencyWalk(rctx context.Context, g *Graph, cb WalkFunc) error {
    // the basic idea of this implementation is that we want to defer schedule
    // children of any given node until after that node's non-child dependencies
    // are satisfied. We're going to have a couple major components of this.
    // First, a scheduler/latch to make sure we don't schedule work more than
Severity: Major
Found in graph/graph.go - About 4 hrs to fix

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

        t.Run("volumes from change", func(t *testing.T) {
            c := &fakeAPIClient{
                FindContainerFunc: func(name string) (*dc.Container, error) {
                    return &dc.Container{
                        Name:   name,
    Severity: Major
    Found in resource/docker/container/container_test.go and 1 other location - About 4 hrs to fix
    resource/docker/container/container_test.go on lines 495..525

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

    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("dns change", func(t *testing.T) {
            c := &fakeAPIClient{
                FindContainerFunc: func(name string) (*dc.Container, error) {
                    return &dc.Container{
                        Name:   name,
    Severity: Major
    Found in resource/docker/container/container_test.go and 1 other location - About 4 hrs to fix
    resource/docker/container/container_test.go on lines 595..622

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

    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

    File fetch_test.go has 579 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // Copyright © 2016 Asteris, LLC
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    Severity: Minor
    Found in resource/file/fetch/fetch_test.go - About 3 hrs to fix

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

                      t.Run("no add-will not attempt add/modify", func(t *testing.T) {
                          grp := &user.Group{
                              Name: fakeName,
                              Gid:  fakeGid,
                          }
      Severity: Major
      Found in resource/group/group_test.go and 1 other location - About 3 hrs to fix
      resource/group/group_test.go on lines 702..721

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

      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("no modify-will not attempt add/modify", func(t *testing.T) {
                          grp := &user.Group{
                              Name: currName,
                              Gid:  fakeGid,
                          }
      Severity: Major
      Found in resource/group/group_test.go and 1 other location - About 3 hrs to fix
      resource/group/group_test.go on lines 636..655

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

      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("internal", func(t *testing.T) {
                      nw := &network.Network{
                          Name:     nwName,
                          State:    network.StatePresent,
                          Internal: true,
      Severity: Major
      Found in resource/docker/network/network_test.go and 1 other location - About 3 hrs to fix
      resource/docker/network/network_test.go on lines 338..359

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

      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("ipv6", func(t *testing.T) {
                      nw := &network.Network{
                          Name:  nwName,
                          State: network.StatePresent,
                          IPv6:  true,
      Severity: Major
      Found in resource/docker/network/network_test.go and 1 other location - About 3 hrs to fix
      resource/docker/network/network_test.go on lines 315..336

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

      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

      Function TestCheck has 116 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestCheck(t *testing.T) {
          t.Parallel()
      
          t.Run("state=present", func(t *testing.T) {
              u := user.NewUser(new(user.System))
      Severity: Major
      Found in resource/user/user_test.go - About 3 hrs to fix

        Function TestShouldEvaluate has 115 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestShouldEvaluate(t *testing.T) {
            t.Run("when-many-branches", func(t *testing.T) {
                g := peerBranchSampleGraph(t)
                resources := []string{"resource1", "resource2", "resource3"}
                t.Run("when-true-true-true", func(t *testing.T) {
        Severity: Major
        Found in graph/node/conditional/conditional_test.go - About 3 hrs to fix

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

          // Copyright © 2016 Asteris, LLC
          //
          // Licensed under the Apache License, Version 2.0 (the "License");
          // you may not use this file except in compliance with the License.
          // You may obtain a copy of the License at
          Severity: Major
          Found in resource/package/rpm/preparer.go and 1 other location - About 3 hrs to fix
          resource/package/apt/preparer.go on lines 1..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 282.

          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

          // Copyright © 2016 Asteris, LLC
          //
          // Licensed under the Apache License, Version 2.0 (the "License");
          // you may not use this file except in compliance with the License.
          // You may obtain a copy of the License at
          Severity: Major
          Found in resource/package/apt/preparer.go and 1 other location - About 3 hrs to fix
          resource/package/rpm/preparer.go on lines 1..60

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

          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

          Function TestContainerCheck has 40 return statements (exceeds 4 allowed).
          Open

          func TestContainerCheck(t *testing.T) {
              t.Parallel()
              defer logging.HideLogs(t)()
          
              t.Run("container not found", func(t *testing.T) {
          Severity: Major
          Found in resource/docker/container/container_test.go - About 3 hrs to fix

            Function TestPrepare has 108 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func TestPrepare(t *testing.T) {
                t.Parallel()
            
                fr := fakerenderer.FakeRenderer{}
                var invalidID = uint32(math.MaxUint32)
            Severity: Major
            Found in resource/user/preparer_test.go - About 3 hrs to fix

              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 TestSetDirsAndContents has 106 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func TestSetDirsAndContents(t *testing.T) {
                    t.Parallel()
                
                    srcFile, err := ioutil.TempFile("", "unarchive_test.zip")
                    require.NoError(t, err)
                Severity: Major
                Found in resource/unarchive/unarchive_test.go - About 3 hrs to fix

                  Function TestNetworkApply has 106 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func TestNetworkApply(t *testing.T) {
                      t.Parallel()
                      defer logging.HideLogs(t)()
                  
                      nwName := "test-network"
                  Severity: Major
                  Found in resource/docker/network/network_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

                      Method User.DiffMod has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (u *User) DiffMod(status *resource.Status, currUser *user.User) (*ModUserOptions, error) {
                          options := new(ModUserOptions)
                      
                          // Check for differences between currUser and the desired modifications
                          if u.NewUsername != "" {
                      Severity: Minor
                      Found in resource/user/user.go - About 3 hrs to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function TestPreparer has 101 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func TestPreparer(t *testing.T) {
                          t.Parallel()
                      
                          t.Run("sets-signal-when-signal-name", func(t *testing.T) {
                              t.Parallel()
                      Severity: Major
                      Found in resource/systemd/unit/preparer_test.go - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language