saltstack/salt

View on GitHub
salt/grains/smartos.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function _smartos_zone_pkgsrc_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def _smartos_zone_pkgsrc_data():
    '''
    SmartOS zone pkgsrc information
    '''
    # Provides:
Severity: Minor
Found in salt/grains/smartos.py - 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 _smartos_zone_pkgin_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _smartos_zone_pkgin_data():
    '''
    SmartOS zone pkgin information
    '''
    # Provides:
Severity: Minor
Found in salt/grains/smartos.py - 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 _smartos_computenode_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _smartos_computenode_data():
    '''
    Return useful information from a SmartOS compute node
    '''
    # Provides:
Severity: Minor
Found in salt/grains/smartos.py - About 45 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

Avoid deeply nested control flow statements.
Open

                    if pkginrepo.match(line):
                        grains['pkgin_repositories'].append(line)

Severity: Major
Found in salt/grains/smartos.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if match_pkgsrcpath:
                            grains['pkgsrcpath'] = match_pkgsrcpath.group(1)
                            match_pkgsrcversion = pkgsrcversion.match(match_pkgsrcpath.group(1))
                            if match_pkgsrcversion:
                                grains['pkgsrcversion'] = match_pkgsrcversion.group(1)
    Severity: Major
    Found in salt/grains/smartos.py - About 45 mins to fix

      Function _smartos_zone_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def _smartos_zone_data():
          '''
          Return useful information from a SmartOS zone
          '''
          # Provides:
      Severity: Minor
      Found in salt/grains/smartos.py - About 25 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