Showing 40 of 40 total issues
Function network_accept_deny_completer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def network_accept_deny_completer(context: DeviceContext, args: list[str]) -> list[str]:
if len(args) == 1:
return [*{*device_network_names(context), *invitation_network_names(context)}]
if len(args) == 2:
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 update_presence
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_presence(
Function list_shop_products
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_shop_products(client: Client) -> dict[str, ShopProduct]:
out = {}
for category in ShopCategory.shop_list(client):
for subcategory in category.subcategories:
for item in subcategory.items:
- 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 build
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build(client: Client, mainboard: str, cpu: str, gpu: str, ram: list[str], disk: list[str]) -> Device:
Function ms
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ms(self, ms: str, endpoint: list[str], *, retry: int = 0, **data: Any) -> dict[str, Any]:
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function create_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_file(context: DeviceContext, filepath: str, content: str) -> None:
*path, filename = filepath.split("/")
parent: File | None = context.path_to_file("/".join(path))
if not parent:
raise CommandError("Parent directory does not exist.")
- 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 request
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def request(self, data: dict[str, Any], no_response: bool = False) -> dict[str, Any]:
if self.websocket is None:
raise ConnectionError
while self.waiting_for_response:
- 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 register
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def register(self, username: str, password: str) -> TokenResponse:
if self.logged_in:
raise LoggedInError
self.init()
- 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_trade
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle_inventory_trade(context: MainContext, args: List[str]) -> None:
"""
Trade with other players
"""
- 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 print_help
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def print_help(context: Context, cmd: Command | None) -> None:
if cmd is None:
cmds: dict[str, Command] = {c.name: c for c in context.get_commands().values()}
else:
print(cmd.description)
- 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 too many return
statements within this function. Open
return [name.replace(" ", "") for name in list(hardware.ram) + list(hardware.disk)]
Avoid too many return
statements within this function. Open
return []
Avoid too many return
statements within this function. Open
return
Function network_kick_completer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def network_kick_completer(context: DeviceContext, args: list[str]) -> list[str]:
if len(args) == 1:
return [*{*device_network_names(context)}]
if len(args) == 2:
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_hostname
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_hostname(context: DeviceContext, args: list[str]) -> None:
"""
Show or modify the name of the 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 handle_feedback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_feedback(context: LoginContext, _: Any) -> None:
"""
Send feedback to the developer
"""
- 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_main_help
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_main_help(context: Context, args: list[str]) -> None:
"""
Show a list of available commands
"""
- 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 stop_bruteforce
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def stop_bruteforce(context: DeviceContext, service: BruteforceService) -> None:
try:
access, _, target_device = service.stop()
except AttackNotRunningError:
raise CommandError("Bruteforce attack is not running.")
- 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_cd
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_cd(context: DeviceContext, args: list[str]) -> None:
"""
Change the current working directory
"""
- 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"