File protocol.py
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Asyncio protocol implementation of RFlink."""
# ./.homeassistant/deps/lib/python/site-packages/rflink/protocol.py
# /Library/Frameworks/Python.framework/Versions/3.6//lib/python3.6/site-packages/rflink/protocol.py
Function create_rflink_connection
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_rflink_connection(
Function create_rflink_connection
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_rflink_connection(
Function create_rflink_connection
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_rflink_connection(
Function connection_made
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def connection_made(self, transport: asyncio.BaseTransport) -> None:
"""Just logging for now."""
self.transport = transport
log.debug("connected")
sock = transport.get_extra_info("socket")
- 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 handle_event
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle_event(self, event: PacketType) -> None:
"""Handle of incoming event (print)."""
string = "{id:<32} "
if "command" in event:
string += "{command}"
- 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 handle_raw_packet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle_raw_packet(self, raw_packet: str) -> None:
"""Parse raw packet string into packet dict."""
log.debug("got packet: %s", raw_packet)
if rflink_log:
print(raw_packet, file=rflink_log)
- 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 _handle_packet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _handle_packet(self, packet: PacketType) -> None:
"""Event specific packet handling logic.
Break packet into events and fires configured event callback or
nicely prints events for console.
- 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"