Hi tagape, thank you for your patience while I review your repo. I have one issue that needs to be addressed and a lot of comments that are optional right now but should be considered for future growth.
Commit hash at time of review - d3a2208279163df749c06137e663753ee46a7c24
- While there doesn’t appear to be anything majorly wrong with this cog it seems to be inconsistent in styling. Style is something we don’t look at for entry level cog creators but I feel like I need to mention it here. There’s tools to help you settle on the style you want but generally PEP8 suggests you stay consistent. I will list a few of the major examples that flake8 is telling me about:
- Line 26-35: unexpected spaces around keyword/parameter equals. Keywords like this should have no space around the equals sign, the real issue is it’s inconsistent between different keywords, some have a space after the keyword and after the equals others have no space after the keyword but a space after the equals.
- Line 43 and elsewhere: Comments in python follow the format
# your comment here Note the space after the
- Line 55-56: indentation contains mixed spaces and tabs. Python has long debated the use of tabs vs spaces but the overarching rule regarding which to use is just be consistent. Don’t mix tabs and spaces if you prefer tabs use tabs for everything if you prefer spaces use spaces for everything. Most IDE’s will even let you reassign the tab key to put in a specified number of spaces to help you keep consistent as well.
- Line 77 and elsewhere: You should not use bare excepts even having
except Exception will let you catch everything going on while being more explicit. Ideally though you have some specific exception you want to catch and then you can more easily differentiate what is going wrong and potentially start logging errors when they happen. The blank
except Exception tends to lead to silenced errors making it harder to determine why something isn’t working the way it should and one should consider alternative ways to find what they’re looking for.
- Line 217 and 227: When you have a value that is a boolean argument the direct comparison of
== is unnecessary as you can just do
if not pred.result or
if autodel alternatively if you want to keep it looking the way it is you can do
if pred.result is False and
if autodel is True
If you install black through the Red contributer guide and set it up you can run that and it will clean up a lot of these style inconsistenceis automatically for you.
- Line 40: Regex patterns should be labelled as raw strings
tl = re.split(r"(\W+)", tags.lower()) (Optional)
- Given the NSFW nature of this cog all commands should be locked behind
@commands.is_nsfw() ensuring the commands can only be used inside designated NSFW channels.
I should note that the comments under ao3.py apply to all your cogs, while they work as is and are fine, if you consider applying for Sr. Cog Creator at some point these items will need to be addressed and should be considered early to improve habits when writing new cogs.