Showing 15 of 49 total issues
File api.py
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Interfaces for Openvario extensions"""
import asyncio
import enum
from abc import abstractmethod
File setupapp.py
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
from typing import Callable
import urwid
File backupapp.py
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import os
from abc import abstractmethod
from pathlib import Path
from typing import Optional
File testing.py
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import os
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Any, Callable, Coroutine, Generator, Iterable, Iterator, Optional
File screen.py
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import functools
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Callable, Coroutine, Iterator, Optional, Sequence
Function unpack_variants
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def unpack_variants(var: Union[Variant, Any], tp: Optional[str] = None) -> Any:
if not isinstance(var, Variant):
if tp is None:
return var
var = Variant(tp, var)
- 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 debounce_esc
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def debounce_esc(keys, raw):
# For some weird reason, SteFly remote stick sends two "Escape" key presses
# when user presses X button once. Whatever reason might be, this is a
# permanent deision and we have to deal with that. We still want to handle
# single escape keypresses though, to support input devices that behave
- 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 _notify_service_changed
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _notify_service_changed(
self, changed: list[tuple[str, dict[str, Variant]]], removed: list[str]
) -> None:
totrack = []
# Update props
- 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 __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Avoid too many return
statements within this function. Open
return [unpack_variants(v, childtype) for v in var.value]
Avoid too many return
statements within this function. Open
return var.value
Function _set_option
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _set_option(self, key: str, value: str) -> None:
modified_line = f'{key}="{value}"\n'
for n, line in enumerate(self.lines):
if "=" not in line:
continue
- 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 _publish
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _publish(self, dev: api.Device, msg: bytes) -> None:
if not self._queues:
return
try:
- 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_service_clicked
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _handle_service_clicked(self, svc: ConnmanService, w: urwid.Widget) -> None:
# Find what actions we can perform with this service
actions = []
can_connect = False
if svc.state in (ConnmanServiceState.IDLE, ConnmanServiceState.FAILURE):
- 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_svcs_changed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _handle_svcs_changed(self) -> None:
svcs = self._manager.list_services()
if not svcs:
self._no_connection()
return
- 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"