OpServ-Monitoring/opserv-backend

View on GitHub

Showing 66 of 66 total issues

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

    def __insert_default_gathering_rates(cls):
        from misc import constants
        default_rates = constants.default_gathering_rates

        insert_values = []
Severity: Minor
Found in app/database/connectors/database_initializer.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

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

    def get_core_measurement(self, metric, args):
        """
            Updates the hardware of the given cpu core to get a measurement
            for the specified metric
        """
Severity: Minor
Found in app/gathering/measuring/ohm_source.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

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

def print_stuff():
    for chip in sensors.get_detected_chips():
        print(chip)

        for feature in chip.get_features():
Severity: Minor
Found in app/gathering/testing-sources/pysensortest.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

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

    def get_measurement(self, component, metric, args):
        '''
            Reads the temperature and frequency out of a file.
            Temprature needs to be converted from millicentigrade to centigrade.
        '''
Severity: Minor
Found in app/gathering/measuring/raspi_temp_source.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

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

    def ohm_hardware_added_handler(self, hardware):
        """
            Hardware Added Handler
            This is called with the given hardware when a new hardware on the computer is found
        """
Severity: Minor
Found in app/gathering/measuring/ohm_source.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

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

    def net_calc_bytesper_sec(self, received, name):
        '''
           Uses the last received data fields to calculate either the receive or sent
           bytes per second. Returns zero if it couldn't be determined
           Also can raise the FileNotFoundError, if the interface can not be found
Severity: Minor
Found in app/gathering/measuring/psutil_source.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

Severity
Category
Status
Source
Language