Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored DOGE-TR branch #6

Open
wants to merge 2 commits into
base: DOGE-TR
Choose a base branch
from

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Feb 27, 2022

Branch DOGE-TR refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the DOGE-TR branch, then run:

git fetch origin sourcery/DOGE-TR
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from MUTLCC February 27, 2022 22:51
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery timed out performing refactorings.

Due to GitHub API limits, only the first 60 comments can be shown.

sample_config.py Outdated
Comment on lines 20 to 21


Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 59-59 refactored with the following changes:

if not self.jsobj:
return None
return self.jsobj
return None if not self.jsobj else self.jsobj
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Main.parse_storage.TheHTMLParser.result refactored with the following changes:

Comment on lines -339 to +337
opt_file = self.options.file
if opt_file:
if opt_file := self.options.file:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Main.create_file_name refactored with the following changes:

__copyright__ = "©️ Copyright 2021, " + __author__
__copyright__ = f"©️ Copyright 2021, {__author__}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 24-72 refactored with the following changes:

LOGS.info(userbot.__license__ + " ile korunmaktadır.")
LOGS.info(f'{userbot.__license__} ile korunmaktadır.')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function startup_process refactored with the following changes:

doginput = "Inline buttons " + markdown_note
doginput = f"Inline buttons {markdown_note}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function button refactored with the following changes:

Comment on lines -78 to 80
event, f"**📺 Geçerli bir YouTube URL'sine girin veya cevap verin!**"
event, "**📺 Geçerli bir YouTube URL'sine girin veya cevap verin!**"
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function yt_inline refactored with the following changes:

Comment on lines -275 to +276
await c_q.answer(f"➡️ Görünüm olarak şu değiştirildi: 📜 Liste", alert=False)
await c_q.answer("➡️ Görünüm olarak şu değiştirildi: 📜 Liste", alert=False)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ytdl_callback refactored with the following changes:

Comment on lines -30 to +42
if reply_message.media:
media = await reply_message.download_media()
if reply_message.text:
await doge.bot.send_file(chat, media, caption=reply_message.text)
else:
await doge.bot.send_file(chat, media)
return await event.delete()

else:
if not reply_message.media:
return await edl(
event,
"__Bot üzerinden ne göndermeliyim? Bana bir metin verin ya da mesajı yanıtlayın.__",
)

media = await reply_message.download_media()
if reply_message.text:
await doge.bot.send_file(chat, media, caption=reply_message.text)
else:
await doge.bot.send_file(chat, media)
return await event.delete()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function botmsg refactored with the following changes:

Comment on lines -66 to +68
f"Bu ayarları yapabilmek için bana özelden yazmalısın!", alert=True
"Bu ayarları yapabilmek için bana özelden yazmalısın!", alert=True
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function settings refactored with the following changes:

Comment on lines -338 to +339
f"🐶 Doɢᴇ UsᴇʀBoᴛ\n\n TAG loggerözelliğiniz başarıyla kapatıldı",
"🐶 Doɢᴇ UsᴇʀBoᴛ\\n\\n TAG loggerözelliğiniz başarıyla kapatıldı",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TAG_LOGGER_OFF refactored with the following changes:

Comment on lines -358 to +372
f"🐶 Doɢᴇ UsᴇʀBoᴛ\n\n TAG Logger özelliğiniz zaten açık!", alert=True
"🐶 Doɢᴇ UsᴇʀBoᴛ\\n\\n TAG Logger özelliğiniz zaten açık!",
alert=True,
)

elif gvar("PM_LOGGER_GROUP_ID") is None and gvar("TAG_LOGGER_GROUP_ID") is None:
await event.answer(
f"🐶 Doɢᴇ UsᴇʀBoᴛ\n\n TAG Logger özelliğini açmak için öncelikle bir grup ayarlamanız gerekir. Sizi grup ayarlama ekranına yönlendiriyorum..."
"🐶 Doɢᴇ UsᴇʀBoᴛ\\n\\n TAG Logger özelliğini açmak için öncelikle bir grup ayarlamanız gerekir. Sizi grup ayarlama ekranına yönlendiriyorum..."
)

await event.edit(
f"""🔔 **Etiketleri kaydetme grubunuzun Doge UserBot tarafından oluşturulmasını istiyorsanız** "`🕹 Otomatik`", **kendiniz ayarlamak istiyorsanız** "`🥏 Manüel`" **yazan butona tıklayın.**""",
"""🔔 **Etiketleri kaydetme grubunuzun Doge UserBot tarafından oluşturulmasını istiyorsanız** "`🕹 Otomatik`", **kendiniz ayarlamak istiyorsanız** "`🥏 Manüel`" **yazan butona tıklayın.**""",
buttons=buttons,
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TAG_LOGGER_ON refactored with the following changes:

Comment on lines -388 to +402
int(gvar("TAG_LOGGER_GROUP_ID")), f"Tag Logger Grubu Test Mesajı!"
int(gvar("TAG_LOGGER_GROUP_ID")),
"Tag Logger Grubu Test Mesajı!",
)

await a.delete()
return await event.edit(
f"Tag Logger için zaten kayıtlı bir grubunuz var! Grup oluşturma işlemini iptal ediyorum",
"Tag Logger için zaten kayıtlı bir grubunuz var! Grup oluşturma işlemini iptal ediyorum",
buttons=get_back_button("TAG_LOGGER_GROUP"),
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TAG_LOGGER_GROUP_AUTO refactored with the following changes:

Comment on lines -460 to +468
f"🐶 Doɢᴇ UsᴇʀBoᴛ\n\ PM Permit özelliğiniz başarıyla kapatıldı",
"🐶 Doɢᴇ UsᴇʀBoᴛ\\n\\ PM Permit özelliğiniz başarıyla kapatıldı",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PM_LOGGER_OFF refactored with the following changes:

Comment on lines -480 to +501
f"🐶 Doɢᴇ UsᴇʀBoᴛ\n\n PM Logger özelliğiniz zaten açık!", alert=True
"🐶 Doɢᴇ UsᴇʀBoᴛ\\n\\n PM Logger özelliğiniz zaten açık!",
alert=True,
)

elif gvar("PM_LOGGER_GROUP_ID") is not None and gvar("pmpermit") != "True":
sgvar("pmpermit", True)
return await event.answer("🐶 PM LOGGER değeriniz açıldı!", alert=True)
elif gvar("PM_LOGGER_GROUP_ID") is None:
await event.answer(
f"🐶 Doɢᴇ UsᴇʀBoᴛ\n\n PM Logger özelliğini açmak için öncelikle bir grup ayarlamanız gerekir. Sizi grup ayarlama ekranına yönlendiriyorum..."
"🐶 Doɢᴇ UsᴇʀBoᴛ\\n\\n PM Logger özelliğini açmak için öncelikle bir grup ayarlamanız gerekir. Sizi grup ayarlama ekranına yönlendiriyorum..."
)

await event.edit(
f"""💬 **PM için log grubunuzun Doge UserBot tarafından oluşturulmasını istiyorsanız** "`🕹 Otomatik`", **kendiniz ayarlamak istiyorsanız** "`🥏 Manüel`" **yazan butona tıklayın.**""",
"""💬 **PM için log grubunuzun Doge UserBot tarafından oluşturulmasını istiyorsanız** "`🕹 Otomatik`", **kendiniz ayarlamak istiyorsanız** "`🥏 Manüel`" **yazan butona tıklayın.**""",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PM_LOGGER_ON refactored with the following changes:

Comment on lines -1641 to +1670
descript = f"🚧 BU KANALI SİLMEYİN!\n\
\n🗑 Eğer bu kanalı silerseniz,\
\n🐾 Kaydederek iletme özelliği çalışmayacaktır.\n\
\n🧡 @DogeUserBot"
descript = "🚧 BU KANALI SİLMEYİN!\\n\\\x1f \\n🗑 Eğer bu kanalı silerseniz,\\\x1f \\n🐾 Kaydederek iletme özelliği çalışmayacaktır.\\n\\\x1f \\n🧡 @DogeUserBot"

gphoto = await doge.upload_file(file="userbot/helpers/resources/DogeBotLog.jpg")
await sleep(0.75)
_, channelid = await create_channel("🐾 Doɢᴇ Gɪzʟɪ Kᴀɴᴀʟ", doge, descript, gphoto)
await sleep(0.75)
descmsg = f"**🚧 BU KANALI SİLMEYİN!\
\n🚧 BU KANALDAN AYRILMAYIN!\
\n🚧 BU KANALI DEĞİŞTİRMEYİN!**\n\
\n🗑 Eğer bu kanalı silerseniz,\
\n🐾 Kaydederek iletme özelliği çalışmayacaktır!\n\
\n**🧡 @DogeUserBot**"
descmsg = "**🚧 BU KANALI SİLMEYİN!\\\x1f \\n🚧 BU KANALDAN AYRILMAYIN!\\\x1f \\n🚧 BU KANALI DEĞİŞTİRMEYİN!**\\n\\\x1f \\n🗑 Eğer bu kanalı silerseniz,\\\x1f \\n🐾 Kaydederek iletme özelliği çalışmayacaktır!\\n\\\x1f \\n**🧡 @DogeUserBot**"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function privatechannel refactored with the following changes:

Comment on lines -1835 to +1854
if (type(rpic.media) == MessageMediaDocument) or (
type(rpic.media) == MessageMediaPhoto
):
if type(rpic.media) in [
MessageMediaDocument,
MessageMediaPhoto,
]:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ss refactored with the following changes:

Comment on lines -214 to +217
text = "**🐶 Doɢᴇ UsᴇʀBoᴛ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾**"
text += "\n\n"
text = "**🐶 Doɢᴇ UsᴇʀBoᴛ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾**" + "\n\n"
text += f"**🚨 Hata Raporu:** [{new['error']}]({pastelink})"
text += "\n\n"
link = f"[BURAYA](https://t.me/DogeSup)"
link = "[BURAYA](https://t.me/DogeSup)"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function DogeUserBotClient.bot_cmd.decorator.wrapper refactored with the following changes:

Comment on lines -354 to +356
text = "**🐶 Doɢᴇ Asɪsᴛᴀɴ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾**"
text += "\n\n"
text = "**🐶 Doɢᴇ Asɪsᴛᴀɴ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾**" + "\n\n"
text += f"**🚨 Hata Raporu:** [{new['error']}]({pastelink})"
text += "\n\n"
link = f"[BURAYA](https://t.me/DogeSup)"
link = "[BURAYA](https://t.me/DogeSup)"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function DogeUserBotClient.shiba_cmd.decorator.wrapper refactored with the following changes:

tmp_chelp += f"\n\n**🐾 Aʏᴀʀ:**"
tmp_chelp += "\\n\\n**🐾 Aʏᴀʀ:**"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _format_about refactored with the following changes:

Comment on lines -45 to +56
if event.sender_id and (
event.sender_id == int(gvar("OWNER_ID"))
or event.sender_id in Config.SUDO_USERS
if (
not event.sender_id
or event.sender_id != int(gvar("OWNER_ID"))
and event.sender_id not in Config.SUDO_USERS
):
try:
await func(event)
except FloodWaitError as e:
await sleep(e.seconds + 5)
except MessageNotModifiedError:
pass
else:
return
try:
await func(event)
except FloodWaitError as e:
await sleep(e.seconds + 5)
except MessageNotModifiedError:
pass
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function sudo_owner.wrapper refactored with the following changes:

text = f"**🚨 Bu komutu kullanabilmek için yönetici olmalıyım!**"
text = "**🚨 Bu komutu kullanabilmek için yönetici olmalıyım!**"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function NewMessage.filter refactored with the following changes:

Comment on lines -380 to +389
chat_id = int("-100" + str(chatid.channel_id))
chat_id = int(f"-100{str(chatid.channel_id)}")
elif isinstance(chatid, InputPeerChat):
chat_id = int("-" + str(chatid.chat_id))
chat_id = int(f"-{str(chatid.chat_id)}")
elif isinstance(chatid, InputPeerUser):
chat_id = int(chatid.user_id)
else:
chat_id = chatid
if str(chat_id) == str(Config.BOTLOG_CHATID):
return await client.editmessage(
entity=entity,
entity=chatid,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function edit_message refactored with the following changes:

buttons = [
(
Button.inline(
f"ℹ️️ Bɪʟɢɪ",
data="check",
),
),
(
buttons = [(Button.inline("ℹ️️ Bɪʟɢɪ", data="check"), ), (
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function back_menu refactored with the following changes:

Comment on lines 97 to 87
buttons = [
(
Button.inline(
f"ℹ️️ Bɪʟɢɪ",
data="check",
),
),
(
buttons = [(Button.inline("ℹ️️ Bɪʟɢɪ", data="check"), ), (
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function main_menu refactored with the following changes:

username = replied_user.user.username
if username:
if username := replied_user.user.username:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function slap refactored with the following changes:

horny = f"**Kategori:** "
horny = "**Kategori:** "
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function nsfw refactored with the following changes:

return str(round(size, 2)) + " " + dict_power_n[raised_to_pow] + "B"
return f'{str(round(size, 2))} {dict_power_n[raised_to_pow]}B'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function humanbytes refactored with the following changes:

Comment on lines -68 to +73
((str(days) + f" gün, ") if days else "")
+ ((str(hours) + f" saat, ") if hours else "")
+ ((str(minutes) + f" dakika, ") if minutes else "")
+ ((str(seconds) + f" saniye, ") if seconds else "")
(f"{str(days)} gün, " if days else "")
+ (f"{str(hours)} saat, " if hours else "")
+ (f"{str(minutes)} dakika, " if minutes else "")
+ (f"{str(seconds)} saniye, " if seconds else "")
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function time_formatter refactored with the following changes:

Comment on lines 87 to 88
return tmp[:-2] + " önce"
return f'{tmp[:-2]} önce'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function afk_time refactored with the following changes:

Signed-off-by: TeleDoge <DogeUserBot@gmail.com>
@sourcery-ai
Copy link
Author

sourcery-ai bot commented Feb 27, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.15%.

Quality metrics Before After Change
Complexity 28.20 😞 27.78 😞 -0.42 👍
Method Length 130.29 😞 129.96 😞 -0.33 👍
Working memory 14.21 😞 14.17 😞 -0.04 👍
Quality 41.91% 😞 42.06% 😞 0.15% 👍
Other metrics Before After Change
Lines 17272 17155 -117
Changed files Quality Before Quality After Quality Change
sample_config.py 52.79% 🙂 55.19% 🙂 2.40% 👍
bin/cmrudl.py 73.58% 🙂 73.39% 🙂 -0.19% 👎
userbot/init.py 19.72% ⛔ 20.26% ⛔ 0.54% 👍
userbot/main.py 70.21% 🙂 70.16% 🙂 -0.05% 👎
userbot/assistant/botcontrols.py 53.96% 🙂 53.70% 🙂 -0.26% 👎
userbot/assistant/botmanagers.py 65.39% 🙂 65.64% 🙂 0.25% 👍
userbot/assistant/buttonmaker.py 45.42% 😞 45.39% 😞 -0.03% 👎
userbot/assistant/iyoutube.py 35.62% 😞 35.69% 😞 0.07% 👍
userbot/assistant/sendbot.py 60.34% 🙂 64.18% 🙂 3.84% 👍
userbot/core/client.py 26.33% 😞 26.39% 😞 0.06% 👍
userbot/core/cmdinfo.py 31.44% 😞 31.50% 😞 0.06% 👍
userbot/core/decorators.py 70.93% 🙂 75.52% ⭐ 4.59% 👍
userbot/core/events.py 41.43% 😞 41.43% 😞 0.00%
userbot/core/inlinebot.py 23.71% ⛔ 23.72% ⛔ 0.01% 👍
userbot/core/managers.py 35.20% 😞 35.20% 😞 0.00%
userbot/helpers/google_image_download.py 38.16% 😞 38.28% 😞 0.12% 👍
userbot/helpers/memeshelper.py 76.53% ⭐ 74.30% 🙂 -2.23% 👎
userbot/helpers/nsfw.py 88.66% ⭐ 88.77% ⭐ 0.11% 👍
userbot/helpers/progress.py 50.48% 🙂 50.38% 🙂 -0.10% 👎
userbot/helpers/functions/calculate.py 61.67% 🙂 62.57% 🙂 0.90% 👍
userbot/helpers/functions/functions.py 79.04% ⭐ 79.01% ⭐ -0.03% 👎
userbot/helpers/functions/imgtools.py 56.67% 🙂 56.73% 🙂 0.06% 👍
userbot/helpers/functions/jikan.py 49.93% 😞 50.17% 🙂 0.24% 👍
userbot/helpers/functions/nekos.py 83.58% ⭐ 83.56% ⭐ -0.02% 👎
userbot/helpers/functions/utils.py 64.16% 🙂 64.12% 🙂 -0.04% 👎
userbot/helpers/functions/utube.py 64.99% 🙂 64.82% 🙂 -0.17% 👎
userbot/helpers/utils/events.py 54.41% 🙂 53.92% 🙂 -0.49% 👎
userbot/helpers/utils/format.py 47.47% 😞 48.29% 😞 0.82% 👍
userbot/helpers/utils/paste.py 63.64% 🙂 63.72% 🙂 0.08% 👍
userbot/plugins/admin.py 38.13% 😞 38.11% 😞 -0.02% 👎
userbot/plugins/afk.py 13.77% ⛔ 14.28% ⛔ 0.51% 👍
userbot/plugins/alive.py 46.51% 😞 46.62% 😞 0.11% 👍
userbot/plugins/android.py 48.57% 😞 46.46% 😞 -2.11% 👎
userbot/plugins/antispambot.py 39.31% 😞 39.51% 😞 0.20% 👍
userbot/plugins/app.py 47.23% 😞 47.23% 😞 0.00%
userbot/plugins/archive.py 39.36% 😞 39.20% 😞 -0.16% 👎
userbot/plugins/autoprofile.py 50.94% 🙂 50.55% 🙂 -0.39% 👎
userbot/plugins/blacklistwords.py 70.63% 🙂 70.63% 🙂 0.00%
userbot/plugins/carbon.py 54.17% 🙂 54.16% 🙂 -0.01% 👎
userbot/plugins/climate.py 48.45% 😞 48.42% 😞 -0.03% 👎
userbot/plugins/contacts.py 46.53% 😞 47.92% 😞 1.39% 👍
userbot/plugins/corecmds.py 54.62% 🙂 57.79% 🙂 3.17% 👍
userbot/plugins/countries.py 25.39% 😞 31.89% 😞 6.50% 👍
userbot/plugins/custom.py 6.56% ⛔ 6.59% ⛔ 0.03% 👍
userbot/plugins/dictionary.py 56.55% 🙂 58.94% 🙂 2.39% 👍
userbot/plugins/download.py 12.75% ⛔ 12.74% ⛔ -0.01% 👎
userbot/plugins/evaluators.py 55.98% 🙂 55.98% 🙂 0.00%
userbot/plugins/feds.py 23.85% ⛔ 23.86% ⛔ 0.01% 👍
userbot/plugins/ffmpeg.py 43.81% 😞 43.82% 😞 0.01% 👍
userbot/plugins/figlet.py 65.00% 🙂 66.10% 🙂 1.10% 👍
userbot/plugins/fileconverts.py 32.05% 😞 32.07% 😞 0.02% 👍
userbot/plugins/filesummary.py 15.62% ⛔ 15.62% ⛔ 0.00%
userbot/plugins/filters.py 45.23% 😞 45.95% 😞 0.72% 👍
userbot/plugins/gdrive.py 30.54% 😞 30.55% 😞 0.01% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
userbot/core/inlinebot.py inline_handler 172 ⛔ 1510 ⛔ 35 ⛔ 0.40% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/afk.py mention_afk 126 ⛔ 767 ⛔ 27 ⛔ 1.47% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/afk.py afk_on_pm 111 ⛔ 562 ⛔ 28 ⛔ 1.55% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/gdrive.py gdrive_download 56 ⛔ 671 ⛔ 34 ⛔ 2.79% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/helpers/google_image_download.py googleimagesdownload.download_image 55 ⛔ 631 ⛔ 28 ⛔ 3.70% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Feb 27, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.18%.

Quality metrics Before After Change
Complexity 28.20 😞 27.71 😞 -0.49 👍
Method Length 130.29 😞 129.95 😞 -0.34 👍
Working memory 14.21 😞 14.17 😞 -0.04 👍
Quality 41.91% 😞 42.09% 😞 0.18% 👍
Other metrics Before After Change
Lines 17272 17158 -114
Changed files Quality Before Quality After Quality Change
sample_config.py 52.79% 🙂 55.19% 🙂 2.40% 👍
bin/cmrudl.py 73.58% 🙂 73.39% 🙂 -0.19% 👎
userbot/init.py 19.72% ⛔ 20.26% ⛔ 0.54% 👍
userbot/main.py 70.21% 🙂 70.16% 🙂 -0.05% 👎
userbot/assistant/botcontrols.py 53.96% 🙂 53.70% 🙂 -0.26% 👎
userbot/assistant/botmanagers.py 65.39% 🙂 65.64% 🙂 0.25% 👍
userbot/assistant/buttonmaker.py 45.42% 😞 45.39% 😞 -0.03% 👎
userbot/assistant/iyoutube.py 35.62% 😞 35.69% 😞 0.07% 👍
userbot/assistant/sendbot.py 60.34% 🙂 64.18% 🙂 3.84% 👍
userbot/core/client.py 26.33% 😞 26.39% 😞 0.06% 👍
userbot/core/cmdinfo.py 31.44% 😞 31.50% 😞 0.06% 👍
userbot/core/decorators.py 70.93% 🙂 75.52% ⭐ 4.59% 👍
userbot/core/events.py 41.43% 😞 41.43% 😞 0.00%
userbot/core/inlinebot.py 23.71% ⛔ 23.72% ⛔ 0.01% 👍
userbot/core/managers.py 35.20% 😞 35.20% 😞 0.00%
userbot/helpers/google_image_download.py 38.16% 😞 38.28% 😞 0.12% 👍
userbot/helpers/memeshelper.py 76.53% ⭐ 74.30% 🙂 -2.23% 👎
userbot/helpers/nsfw.py 88.66% ⭐ 88.77% ⭐ 0.11% 👍
userbot/helpers/progress.py 50.48% 🙂 50.38% 🙂 -0.10% 👎
userbot/helpers/functions/calculate.py 61.67% 🙂 62.57% 🙂 0.90% 👍
userbot/helpers/functions/functions.py 79.04% ⭐ 79.01% ⭐ -0.03% 👎
userbot/helpers/functions/imgtools.py 56.67% 🙂 56.73% 🙂 0.06% 👍
userbot/helpers/functions/jikan.py 49.93% 😞 50.17% 🙂 0.24% 👍
userbot/helpers/functions/nekos.py 83.58% ⭐ 83.56% ⭐ -0.02% 👎
userbot/helpers/functions/utils.py 64.16% 🙂 64.12% 🙂 -0.04% 👎
userbot/helpers/functions/utube.py 64.99% 🙂 64.82% 🙂 -0.17% 👎
userbot/helpers/utils/events.py 54.41% 🙂 53.92% 🙂 -0.49% 👎
userbot/helpers/utils/format.py 47.47% 😞 48.29% 😞 0.82% 👍
userbot/helpers/utils/paste.py 63.64% 🙂 63.72% 🙂 0.08% 👍
userbot/plugins/admin.py 38.13% 😞 38.11% 😞 -0.02% 👎
userbot/plugins/afk.py 13.77% ⛔ 14.28% ⛔ 0.51% 👍
userbot/plugins/alive.py 46.51% 😞 46.62% 😞 0.11% 👍
userbot/plugins/android.py 48.57% 😞 46.46% 😞 -2.11% 👎
userbot/plugins/antispambot.py 39.31% 😞 39.51% 😞 0.20% 👍
userbot/plugins/app.py 47.23% 😞 47.23% 😞 0.00%
userbot/plugins/archive.py 39.36% 😞 39.20% 😞 -0.16% 👎
userbot/plugins/autoprofile.py 50.94% 🙂 50.55% 🙂 -0.39% 👎
userbot/plugins/blacklistwords.py 70.63% 🙂 70.63% 🙂 0.00%
userbot/plugins/carbon.py 54.17% 🙂 54.16% 🙂 -0.01% 👎
userbot/plugins/climate.py 48.45% 😞 48.42% 😞 -0.03% 👎
userbot/plugins/contacts.py 46.53% 😞 47.92% 😞 1.39% 👍
userbot/plugins/corecmds.py 54.62% 🙂 57.79% 🙂 3.17% 👍
userbot/plugins/countries.py 25.39% 😞 31.89% 😞 6.50% 👍
userbot/plugins/custom.py 6.56% ⛔ 6.59% ⛔ 0.03% 👍
userbot/plugins/dictionary.py 56.55% 🙂 58.94% 🙂 2.39% 👍
userbot/plugins/download.py 12.75% ⛔ 12.74% ⛔ -0.01% 👎
userbot/plugins/evaluators.py 55.98% 🙂 55.98% 🙂 0.00%
userbot/plugins/feds.py 23.85% ⛔ 24.28% ⛔ 0.43% 👍
userbot/plugins/ffmpeg.py 43.81% 😞 43.82% 😞 0.01% 👍
userbot/plugins/figlet.py 65.00% 🙂 66.10% 🙂 1.10% 👍
userbot/plugins/fileconverts.py 32.05% 😞 32.07% 😞 0.02% 👍
userbot/plugins/filesummary.py 15.62% ⛔ 15.62% ⛔ 0.00%
userbot/plugins/filters.py 45.23% 😞 45.95% 😞 0.72% 👍
userbot/plugins/gdrive.py 30.54% 😞 30.55% 😞 0.01% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
userbot/core/inlinebot.py inline_handler 172 ⛔ 1510 ⛔ 35 ⛔ 0.40% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/afk.py mention_afk 126 ⛔ 767 ⛔ 27 ⛔ 1.47% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/afk.py afk_on_pm 111 ⛔ 562 ⛔ 28 ⛔ 1.55% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/gdrive.py gdrive_download 56 ⛔ 671 ⛔ 34 ⛔ 2.79% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/helpers/google_image_download.py googleimagesdownload.download_image 55 ⛔ 631 ⛔ 28 ⛔ 3.70% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Feb 27, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.18%.

Quality metrics Before After Change
Complexity 28.20 😞 27.71 😞 -0.49 👍
Method Length 130.29 😞 129.95 😞 -0.34 👍
Working memory 14.21 😞 14.17 😞 -0.04 👍
Quality 41.91% 😞 42.09% 😞 0.18% 👍
Other metrics Before After Change
Lines 17272 17154 -118
Changed files Quality Before Quality After Quality Change
sample_config.py 52.79% 🙂 55.19% 🙂 2.40% 👍
bin/cmrudl.py 73.58% 🙂 73.39% 🙂 -0.19% 👎
userbot/init.py 19.72% ⛔ 20.26% ⛔ 0.54% 👍
userbot/main.py 70.21% 🙂 70.16% 🙂 -0.05% 👎
userbot/assistant/botcontrols.py 53.96% 🙂 53.70% 🙂 -0.26% 👎
userbot/assistant/botmanagers.py 65.39% 🙂 65.64% 🙂 0.25% 👍
userbot/assistant/buttonmaker.py 45.42% 😞 45.39% 😞 -0.03% 👎
userbot/assistant/iyoutube.py 35.62% 😞 35.69% 😞 0.07% 👍
userbot/assistant/sendbot.py 60.34% 🙂 64.18% 🙂 3.84% 👍
userbot/core/client.py 26.33% 😞 26.39% 😞 0.06% 👍
userbot/core/cmdinfo.py 31.44% 😞 31.50% 😞 0.06% 👍
userbot/core/decorators.py 70.93% 🙂 75.52% ⭐ 4.59% 👍
userbot/core/events.py 41.43% 😞 41.43% 😞 0.00%
userbot/core/inlinebot.py 23.71% ⛔ 23.72% ⛔ 0.01% 👍
userbot/core/managers.py 35.20% 😞 35.20% 😞 0.00%
userbot/helpers/google_image_download.py 38.16% 😞 38.28% 😞 0.12% 👍
userbot/helpers/memeshelper.py 76.53% ⭐ 74.30% 🙂 -2.23% 👎
userbot/helpers/nsfw.py 88.66% ⭐ 88.77% ⭐ 0.11% 👍
userbot/helpers/progress.py 50.48% 🙂 50.38% 🙂 -0.10% 👎
userbot/helpers/functions/calculate.py 61.67% 🙂 63.12% 🙂 1.45% 👍
userbot/helpers/functions/functions.py 79.04% ⭐ 79.01% ⭐ -0.03% 👎
userbot/helpers/functions/imgtools.py 56.67% 🙂 56.73% 🙂 0.06% 👍
userbot/helpers/functions/jikan.py 49.93% 😞 50.17% 🙂 0.24% 👍
userbot/helpers/functions/nekos.py 83.58% ⭐ 83.56% ⭐ -0.02% 👎
userbot/helpers/functions/utils.py 64.16% 🙂 64.12% 🙂 -0.04% 👎
userbot/helpers/functions/utube.py 64.99% 🙂 64.82% 🙂 -0.17% 👎
userbot/helpers/utils/events.py 54.41% 🙂 53.92% 🙂 -0.49% 👎
userbot/helpers/utils/format.py 47.47% 😞 48.29% 😞 0.82% 👍
userbot/helpers/utils/paste.py 63.64% 🙂 63.72% 🙂 0.08% 👍
userbot/plugins/admin.py 38.13% 😞 38.11% 😞 -0.02% 👎
userbot/plugins/afk.py 13.77% ⛔ 14.28% ⛔ 0.51% 👍
userbot/plugins/alive.py 46.51% 😞 46.62% 😞 0.11% 👍
userbot/plugins/android.py 48.57% 😞 46.46% 😞 -2.11% 👎
userbot/plugins/antispambot.py 39.31% 😞 39.51% 😞 0.20% 👍
userbot/plugins/app.py 47.23% 😞 47.23% 😞 0.00%
userbot/plugins/archive.py 39.36% 😞 39.20% 😞 -0.16% 👎
userbot/plugins/autoprofile.py 50.94% 🙂 50.55% 🙂 -0.39% 👎
userbot/plugins/blacklistwords.py 70.63% 🙂 70.63% 🙂 0.00%
userbot/plugins/carbon.py 54.17% 🙂 54.16% 🙂 -0.01% 👎
userbot/plugins/climate.py 48.45% 😞 48.42% 😞 -0.03% 👎
userbot/plugins/contacts.py 46.53% 😞 47.92% 😞 1.39% 👍
userbot/plugins/corecmds.py 54.62% 🙂 57.79% 🙂 3.17% 👍
userbot/plugins/countries.py 25.39% 😞 31.89% 😞 6.50% 👍
userbot/plugins/custom.py 6.56% ⛔ 6.59% ⛔ 0.03% 👍
userbot/plugins/dictionary.py 56.55% 🙂 58.94% 🙂 2.39% 👍
userbot/plugins/download.py 12.75% ⛔ 12.74% ⛔ -0.01% 👎
userbot/plugins/evaluators.py 55.98% 🙂 55.98% 🙂 0.00%
userbot/plugins/feds.py 23.85% ⛔ 24.28% ⛔ 0.43% 👍
userbot/plugins/ffmpeg.py 43.81% 😞 43.82% 😞 0.01% 👍
userbot/plugins/figlet.py 65.00% 🙂 66.10% 🙂 1.10% 👍
userbot/plugins/fileconverts.py 32.05% 😞 32.07% 😞 0.02% 👍
userbot/plugins/filesummary.py 15.62% ⛔ 15.62% ⛔ 0.00%
userbot/plugins/filters.py 45.23% 😞 45.95% 😞 0.72% 👍
userbot/plugins/gdrive.py 30.54% 😞 30.55% 😞 0.01% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
userbot/core/inlinebot.py inline_handler 172 ⛔ 1510 ⛔ 35 ⛔ 0.40% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/afk.py mention_afk 126 ⛔ 767 ⛔ 27 ⛔ 1.47% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/afk.py afk_on_pm 111 ⛔ 562 ⛔ 28 ⛔ 1.55% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/plugins/gdrive.py gdrive_download 56 ⛔ 671 ⛔ 34 ⛔ 2.79% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userbot/helpers/google_image_download.py googleimagesdownload.download_image 55 ⛔ 631 ⛔ 28 ⛔ 3.70% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant