Showing 61 of 61 total issues
Function __init__
has 20 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
File config.py
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
# mautrix-telegram - A Matrix-Telegram puppeting bridge
# Copyright (C) 2021 Tulir Asokan
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
Function _parse_flag
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _parse_flag(args: list[str]) -> tuple[str, str]:
arg = args.pop(0).lower()
if arg == "--":
return "", ""
value = ""
- 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 command_handler
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def command_handler(
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function get_mx_login_response
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_mx_login_response(
Function __init__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function get_login_response
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_login_response(
Function get_mx_login_response
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_mx_login_response(
Function get_mx_login_response
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_mx_login_response(
Function get_login_response
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_login_response(
Function new
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def new(
Function get_login_response
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_login_response(
Function __init__
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, bridge: "TelegramBridge") -> None:
super().__init__(bridge.loop)
self.secret = bridge.config["appservice.provisioning.shared_secret"]
self.az = bridge.az
self.bridge = bridge
Function get_displayname
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_displayname(cls, info: User | Channel, enable_format: bool = True) -> tuple[str, int]:
if isinstance(info, Channel):
fn, ln = cls._filter_name(info.title), ""
else:
fn = cls._filter_name(info.first_name)
- 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 _hash_content
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _hash_content(self, event: TypeMessage) -> Generator[Any, None, None]:
if not self._always_force_hash:
yield event.id
yield int(event.date.timestamp())
if isinstance(event, MessageService):
- 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 _cut_long_message
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _cut_long_message(
message: str, entities: list[TypeMessageEntity]
) -> tuple[str, list[TypeMessageEntity]]:
if len(message) > MAX_LENGTH:
message = message[0:CUT_MAX_LENGTH] + CUTOFF_TEXT
- 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 config_add_del
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def config_add_del(
evt: CommandEvent, portal: po.Portal, key: str, value: str, cmd: str
) -> Awaitable[EventID]:
if not key or value is None:
return evt.reply(f"**Usage:** `$cmdprefix+sp config {cmd} <key> <value>`")
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(