extensions/status.py
Function statustovk_prs01
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
Open
def statustovk_prs01(source, prs, retry=3):
if source in Users and prs.getType() in ("available", None):
if prs.getTo() == TransportID:
user = Users[source]
if user.settings.status_to_vk:
- 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
Avoid deeply nested control flow statements. Open
Open
if not getattr(user, "last_status", None) or user.last_status != status:
if mask & 1024 == 1024:
if not status:
user.vk.method("status.set", {"text": ""})
else:
Avoid deeply nested control flow statements. Open
Open
if retry:
utils.runThread(statustovk_prs01, (source, prs, (retry -1)), delay=10)
Function statusfromvk_prs02
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def statusfromvk_prs02(prs, destination, source):
if source != TransportID and destination in Users:
user = Users[destination]
if user.settings.status_from_vk and not prs.getType():
id = vk2xmpp(source)
- 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"