EDM115 / unzip-bot

Function with cyclomatic complexity higher than threshold PY-R1000
Anti-pattern
Minor
21 days ago6 months old
unzipper_cb has a cyclomatic complexity of 168 with "critical" risk
 119
 120# Callbacks
 121@unzipperbot.on_callback_query()
 122async def unzipper_cb(unzip_bot: Client, query: CallbackQuery): 123    uid = query.from_user.id
 124    if uid != Config.BOT_OWNER:  # skipcq: PTC-W0048
 125        if await count_ongoing_tasks() >= Config.MAX_CONCURRENT_TASKS:
get_audio_metadata has a cyclomatic complexity of 20 with "high" risk
 14from unzipper.modules.ext_script.ext_helper import run_cmds_on_cr, __run_cmds_unzipper
 15
 16
 17async def get_audio_metadata(file_path): 18    file_ext = file_path.split(".")[-1].lower()
 19    audio_meta = {"performer": None, "title": None, "duration": None}
 20
send_file has a cyclomatic complexity of 27 with "very-high" risk
 46
 47
 48# Send file to a user
 49async def send_file(unzip_bot, c_id, doc_f, query, full_path, log_msg, split): 50    fsize = await get_size(doc_f)
 51    if fsize in (-1, 0):  # File not found or empty
 52        try:
add_vip has a cyclomatic complexity of 16 with "high" risk
630@unzipperbot.on_message(
631    filters.private & filters.command("addvip") & filters.user(Config.BOT_OWNER)
632)
633async def add_vip(_, message: Message):634    if message.reply_to_message is None:
635        await message.reply(Messages.VIP_REQUIRED_MESSAGE)
636        return