asteris-llc/converge

View on GitHub
resource/systemd/unit/systemd_properties.go

Summary

Maintainability
F
1 mo
Test Coverage

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

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

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

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

                func newScopeTypePropertiesFromMap(m map[string]interface{}) *ScopeTypeProperties {
                    s := &ScopeTypeProperties{}
                
                    if val, ok := m["BlockIOAccounting"]; ok {
                        s.BlockIOAccounting = val.(bool)
                Severity: Minor
                Found in resource/systemd/unit/systemd_properties.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 newSliceTypePropertiesFromMap has 68 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func newSliceTypePropertiesFromMap(m map[string]interface{}) *SliceTypeProperties {
                    s := &SliceTypeProperties{}
                
                    if val, ok := m["BlockIOAccounting"]; ok {
                        s.BlockIOAccounting = val.(bool)
                Severity: Minor
                Found in resource/systemd/unit/systemd_properties.go - About 1 hr to fix

                  Function newSliceTypePropertiesFromMap has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func newSliceTypePropertiesFromMap(m map[string]interface{}) *SliceTypeProperties {
                      s := &SliceTypeProperties{}
                  
                      if val, ok := m["BlockIOAccounting"]; ok {
                          s.BlockIOAccounting = val.(bool)
                  Severity: Minor
                  Found in resource/systemd/unit/systemd_properties.go - About 35 mins 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

                  There are no issues that match your filters.

                  Category
                  Status