Showing 40 of 40 total issues
Function handle_bruteforce
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def handle_bruteforce(context: DeviceContext, args: list[str]) -> None:
"""
Start a bruteforce attack
"""
- 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_device_build
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def handle_device_build(context: MainContext, args: list[str]) -> None:
"""
Build a new device
"""
- 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 service.py
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import time
from typing import Any, cast
from .command import command, CommandError
Function handle_membership_request
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def handle_membership_request(context: DeviceContext, args: list[str], accept: bool) -> None:
if len(args) not in (1, 2):
raise CommandError(f"usage: network {['deny', 'accept'][accept]} <network> [<device>]")
network: Network = get_network(context, args[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
File network.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Any
from .command import command, CommandError
from .device import get_device
from .help import print_help
Device
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Device(Model):
uuid: str
name: str
owner_uuid: str = Field(alias="owner")
powered_on: bool
File files.py
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Any, cast
from .command import command, CommandError
from ..context import DeviceContext
from ..exceptions import (
File device.py
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Any, cast
from .command import command, CommandError
from .help import print_help
from ..context import MainContext, DeviceContext
Function handle_remote_connect
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def handle_remote_connect(context: MainContext, args: list[str]) -> None:
"""
Connect to a remote device
"""
- 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 ms
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def ms(self, ms: str, endpoint: list[str], *, retry: int = 0, **data: Any) -> dict[str, Any]:
if not self.logged_in:
raise LoggedOutError
response: dict[str, Any] = self.request({"ms": ms, "endpoint": endpoint, "data": data, "tag": uuid()})
- 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_rm
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def handle_rm(context: DeviceContext, args: list[str]) -> None:
"""
Remove a file
"""
- 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 get_device
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_device(context: MainContext, name_or_uuid: str, devices: list[Device] | None = None) -> Device:
if is_uuid(name_or_uuid):
try:
return Device.get_device(context.client, name_or_uuid)
except DeviceNotFoundError:
- 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_inventory_list
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def handle_inventory_list(context: MainContext, _: Any) -> None:
"""
List your inventory
"""
- 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_create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def handle_service_create(context: DeviceContext, args: list[str]) -> None:
"""
Create a new service
"""
- 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 mainloop
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def mainloop(self) -> NoReturn:
while True:
self.get_context().loop_tick()
context: Context = self.get_context()
- 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 make_commands
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def make_commands() -> dict[Type[Context], dict[str, Command]]:
for module in [
"account",
"help",
"shell",
- 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 path_to_file
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def path_to_file(self, path: str) -> File | None:
pwd: File = self.get_root_dir() if path.startswith("/") else self.pwd
for file_name in path.split("/"):
if not file_name or file_name == ".":
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 make_subcommands
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def make_subcommands(self) -> None:
for cmd in self.subcommands:
for context in cmd.contexts:
for name in [cmd.name] + cmd.aliases:
if name in self.prepared_subcommands.setdefault(context, {}):
- 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_morphcoin_transactions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def handle_morphcoin_transactions(context: DeviceContext, args: list[str]) -> None:
"""
View the transaction history of your wallet
"""
- 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_pay
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def handle_pay(context: DeviceContext, args: list[str]) -> None:
"""
Send Morphcoins to another wallet
"""
- 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"