asteris-llc/converge

View on GitHub

Showing 247 of 615 total issues

Function TestNetworkCheck has 295 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    nwName := "test-network"
Severity: Major
Found in resource/docker/network/network_test.go - About 1 day to fix

    Function TestDiffMod has 290 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestDiffMod(t *testing.T) {
        t.Parallel()
    
        t.Run("set all options", func(t *testing.T) {
            u := user.NewUser(new(user.System))
    Severity: Major
    Found in resource/user/user_test.go - About 1 day to fix

      Function TestApply has 283 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestApply(t *testing.T) {
          t.Parallel()
      
          t.Run("hash error", func(t *testing.T) {
              task := fetch.Fetch{
      Severity: Major
      Found in resource/file/fetch/fetch_test.go - About 1 day to fix

        Function TestApply has 277 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestApply(t *testing.T) {
            t.Parallel()
            t.Run("query-unit-returns-error", func(t *testing.T) {
                t.Parallel()
                expected := errors.New("error1")
        Severity: Major
        Found in resource/systemd/unit/resource_test.go - About 1 day to fix

          File systemd_linux_test.go has 834 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: Major
          Found in resource/systemd/unit/systemd_linux_test.go - About 1 day to fix

            Function newPropertiesFromMap has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
            Open

            func newPropertiesFromMap(m map[string]interface{}) *Properties {
                s := &Properties{}
            
                if val, ok := m["ActiveEnterTimestamp"]; ok {
                    s.ActiveEnterTimestamp = val.(uint64)
            Severity: Minor
            Found in resource/systemd/unit/systemd_properties.go - About 1 day 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 Group.Apply has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
            Open

            func (g *Group) Apply(context.Context) (resource.TaskStatus, error) {
                var (
                    groupByGid *user.Group
                    gidErr     error
                    newNameErr error
            Severity: Minor
            Found in resource/group/group.go - About 1 day 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 TestEvaluateDuplicates has 248 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func TestEvaluateDuplicates(t *testing.T) {
                t.Parallel()
            
                t.Run("no duplicates", func(t *testing.T) {
                    destDir, err := ioutil.TempDir("", "destDir_unarchive")
            Severity: Major
            Found in resource/unarchive/unarchive_test.go - About 1 day to fix

              Function TestApply has 247 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func TestApply(t *testing.T) {
                  t.Parallel()
              
                  srcDir, err := ioutil.TempDir("", "unarchive_srcDir")
                  require.NoError(t, err)
              Severity: Major
              Found in resource/unarchive/unarchive_test.go - About 1 day to fix

                Function TestApply has 246 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func TestApply(t *testing.T) {
                    t.Parallel()
                
                    t.Run("state=present", func(t *testing.T) {
                        t.Run("add tests", func(t *testing.T) {
                Severity: Major
                Found in resource/user/user_test.go - About 1 day to fix

                  Function newPropertiesFromMap has 224 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func newPropertiesFromMap(m map[string]interface{}) *Properties {
                      s := &Properties{}
                  
                      if val, ok := m["ActiveEnterTimestamp"]; ok {
                          s.ActiveEnterTimestamp = val.(uint64)
                  Severity: Major
                  Found in resource/systemd/unit/systemd_properties.go - About 7 hrs to fix

                    Function TestCopyToFinalDest has 213 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func TestCopyToFinalDest(t *testing.T) {
                        t.Parallel()
                    
                        t.Run("no duplicates", func(t *testing.T) {
                            destDir, err := ioutil.TempDir("", "destDir_unarchive")
                    Severity: Major
                    Found in resource/unarchive/unarchive_test.go - About 7 hrs to fix

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

                      func TestPreparer(t *testing.T) {
                          t.Parallel()
                      
                          var (
                              fr       = fakerenderer.FakeRenderer{}
                      Severity: Major
                      Found in resource/unarchive/preparer_test.go - About 7 hrs to fix

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

                        func TestCheck(t *testing.T) {
                            t.Parallel()
                            t.Run("send-signal", func(t *testing.T) {
                                r := &Resource{
                                    State:        "running",
                        Severity: Major
                        Found in resource/systemd/unit/resource_test.go - About 7 hrs to fix

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

                          func TestPreparer(t *testing.T) {
                              t.Parallel()
                          
                              var (
                                  fr       = fakerenderer.FakeRenderer{}
                          Severity: Major
                          Found in resource/file/fetch/preparer_test.go - About 6 hrs to fix

                            Function TestDiffFile has 188 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func TestDiffFile(t *testing.T) {
                                t.Parallel()
                            
                                t.Run("fetch new file", func(t *testing.T) {
                                    t.Run("with checksum", func(t *testing.T) {
                            Severity: Major
                            Found in resource/file/fetch/fetch_test.go - About 6 hrs to fix

                              File resource_test.go has 688 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/systemd/unit/resource_test.go - About 6 hrs to fix

                                Function dependencyWalk has a Cognitive Complexity of 53 (exceeds 20 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: Minor
                                Found in graph/graph.go - About 5 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 TestOwnershipDiff has 159 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func TestOwnershipDiff(t *testing.T) {
                                    users := []*user.User{
                                        fakeUser("1", "1", "user-1"),
                                        fakeUser("2", "2", "user-2"),
                                        fakeUser("3", "3", "user-3"),
                                Severity: Major
                                Found in resource/file/owner/ownership_test.go - About 5 hrs to fix

                                  Function peerBranchSampleGraph has 146 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func peerBranchSampleGraph(t *testing.T) *graph.Graph {
                                      g := graph.New()
                                  
                                      g.Add(node.New(graph.ID("root"), struct{}{}))
                                      g.Add(node.New(graph.ID("root", "switch1"), struct{}{}))
                                  Severity: Major
                                  Found in graph/node/conditional/conditional_test.go - About 4 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language