Showing 8 of 8 total issues
Function from_js
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def from_js(data: str) -> Inverter:
"""Return Inverter object from the Omnik Inverter response.
Args:
----
- Read upRead up
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 tcp.py
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Data model and conversions for tcp-based communication with the Omnik Inverter."""
from __future__ import annotations
from ctypes import BigEndianStructure, c_char, c_ubyte, c_uint, c_ushort, sizeof
Function parse
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def parse(cls, data: bytes, offset: int = 0) -> dict[str, Any]:
"""Parse `data` into all fields described by this C structure."""
tcp_data = cls.from_buffer_copy(data, offset)
if tcp_data.unknown0 not in [0, UINT16_MAX]: # pragma: no cover
- Read upRead up
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 models.py
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Models for Omnik Inverter."""
from __future__ import annotations
import re
Function from_html
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def from_html(data: str) -> Inverter:
"""Return Inverter object from the Omnik Inverter response.
Args:
----
- Read upRead up
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 _unpack_messages
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _unpack_messages(
data: bytearray,
) -> Generator[tuple[int, int, bytearray], None, None]:
while len(data):
message_start = data.pop(0)
- Read upRead up
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 from_html
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_html(data: str) -> Device:
"""Return Device object from the Omnik Inverter response.
Args:
----
- Read upRead up
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 from_js
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_js(data: str) -> Device:
"""Return Device object from the Omnik Inverter response.
Args:
----
- Read upRead up
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"