RaspberrySense/messenger-chatbot

View on GitHub
sensors/DHT22.py

Summary

Maintainability
A
0 mins
Test Coverage

Function _cb has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def _cb(self, gpio, level, tick):
        """
        Accumulate the 40 data bits.  Format into 5 bytes, humidity high,
        humidity low, temperature high, temperature low, checksum.
        """
Severity: Minor
Found in sensors/DHT22.py - About 7 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

Avoid deeply nested control flow statements.
Wontfix

                        if self.tH & 128:  # Negative temperature.
                            mult = -0.1
                            self.tH = self.tH & 127
                        else:
                            mult = 0.1
Severity: Major
Found in sensors/DHT22.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Wontfix

                            if self.LED is not None:
                                self.pi.write(self.LED, 0)
    
    
    Severity: Major
    Found in sensors/DHT22.py - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status