asteris-llc/converge

View on GitHub

Showing 247 of 572 total issues

File systemd_properties.go has 2973 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Copyright © 2017 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_properties.go - About 1 wk to fix

    Function newSocketTypePropertiesFromMap has a Cognitive Complexity of 167 (exceeds 20 allowed). Consider refactoring.
    Open

    func newSocketTypePropertiesFromMap(m map[string]interface{}) *SocketTypeProperties {
        s := &SocketTypeProperties{}
    
        if val, ok := m["Accept"]; ok {
            s.Accept = val.(bool)
    Severity: Minor
    Found in resource/systemd/unit/systemd_properties.go - About 3 days 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 newServiceTypePropertiesFromMap has a Cognitive Complexity of 156 (exceeds 20 allowed). Consider refactoring.
    Open

    func newServiceTypePropertiesFromMap(m map[string]interface{}) *ServiceTypeProperties {
        s := &ServiceTypeProperties{}
    
        if val, ok := m["AmbientCapabilities"]; ok {
            s.AmbientCapabilities = val.(uint64)
    Severity: Minor
    Found in resource/systemd/unit/systemd_properties.go - About 2 days 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 TestContainerCheck has 556 lines of code (exceeds 50 allowed). Consider refactoring.
    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 2 days to fix

      File user_test.go has 1224 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/user/user_test.go - About 2 days to fix

        Function newSocketTypePropertiesFromMap has 503 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func newSocketTypePropertiesFromMap(m map[string]interface{}) *SocketTypeProperties {
            s := &SocketTypeProperties{}
        
            if val, ok := m["Accept"]; ok {
                s.Accept = val.(bool)
        Severity: Major
        Found in resource/systemd/unit/systemd_properties.go - About 2 days to fix

          Function newMountTypePropertiesFromMap has a Cognitive Complexity of 129 (exceeds 20 allowed). Consider refactoring.
          Open

          func newMountTypePropertiesFromMap(m map[string]interface{}) *MountTypeProperties {
              s := &MountTypeProperties{}
          
              if val, ok := m["AmbientCapabilities"]; ok {
                  s.AmbientCapabilities = val.(uint64)
          Severity: Minor
          Found in resource/systemd/unit/systemd_properties.go - About 2 days 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 newServiceTypePropertiesFromMap has 470 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func newServiceTypePropertiesFromMap(m map[string]interface{}) *ServiceTypeProperties {
              s := &ServiceTypeProperties{}
          
              if val, ok := m["AmbientCapabilities"]; ok {
                  s.AmbientCapabilities = val.(uint64)
          Severity: Major
          Found in resource/systemd/unit/systemd_properties.go - About 2 days to fix

            Function newSwapTypePropertiesFromMap has a Cognitive Complexity of 125 (exceeds 20 allowed). Consider refactoring.
            Open

            func newSwapTypePropertiesFromMap(m map[string]interface{}) *SwapTypeProperties {
                s := &SwapTypeProperties{}
            
                if val, ok := m["AmbientCapabilities"]; ok {
                    s.AmbientCapabilities = val.(uint64)
            Severity: Minor
            Found in resource/systemd/unit/systemd_properties.go - About 2 days 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 TestCheck has a Cognitive Complexity of 124 (exceeds 20 allowed). Consider refactoring.
            Open

            func TestCheck(t *testing.T) {
                t.Parallel()
            
                t.Run("state=present", func(t *testing.T) {
                    g := group.NewGroup(new(group.System))
            Severity: Minor
            Found in resource/group/group_test.go - About 2 days 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

            File unarchive_test.go has 1127 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            // Copyright © 2017 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/unarchive/unarchive_test.go - About 2 days to fix

              Function TestApply has 431 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("gid not provided", func(t *testing.T) {
              Severity: Major
              Found in resource/group/group_test.go - About 2 days to fix

                Function newMountTypePropertiesFromMap has 389 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func newMountTypePropertiesFromMap(m map[string]interface{}) *MountTypeProperties {
                    s := &MountTypeProperties{}
                
                    if val, ok := m["AmbientCapabilities"]; ok {
                        s.AmbientCapabilities = val.(uint64)
                Severity: Major
                Found in resource/systemd/unit/systemd_properties.go - About 1 day to fix

                  Function TestListUnits has 383 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func TestListUnits(t *testing.T) {
                      t.Parallel()
                  
                      t.Run("when-dbus-errors", func(t *testing.T) {
                          t.Run("list-units-returns-error", func(t *testing.T) {
                  Severity: Major
                  Found in resource/systemd/unit/systemd_linux_test.go - About 1 day to fix

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

                    func TestCheck(t *testing.T) {
                        t.Parallel()
                    
                        users := []*user.User{
                            fakeUser("1", "1", "user-1"),
                    Severity: Major
                    Found in resource/file/owner/owner_test.go - About 1 day to fix

                      Function newSwapTypePropertiesFromMap has 377 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func newSwapTypePropertiesFromMap(m map[string]interface{}) *SwapTypeProperties {
                          s := &SwapTypeProperties{}
                      
                          if val, ok := m["AmbientCapabilities"]; ok {
                              s.AmbientCapabilities = val.(uint64)
                      Severity: Major
                      Found in resource/systemd/unit/systemd_properties.go - About 1 day to fix

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

                        func TestCheck(t *testing.T) {
                            t.Parallel()
                        
                            t.Run("state=present", func(t *testing.T) {
                                g := group.NewGroup(new(group.System))
                        Severity: Major
                        Found in resource/group/group_test.go - About 1 day to fix

                          Function TestPreparerPrepare has 306 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func TestPreparerPrepare(t *testing.T) {
                              defer logging.HideLogs(t)()
                          
                              // newWithField is a little utility. We have this pattern over and over
                              // where we need to set a target field and then check that we render without
                          Severity: Major
                          Found in resource/preparer_test.go - About 1 day to fix

                            Function TestDiffAdd has 302 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func TestDiffAdd(t *testing.T) {
                                t.Parallel()
                            
                                zone := time.FixedZone(time.Now().In(time.Local).Zone())
                                expiryString := "1996-12-12"
                            Severity: Major
                            Found in resource/user/user_test.go - About 1 day to fix

                              File group_test.go has 874 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/group/group_test.go - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language