Do it.
Use flake8 linter, use the include .flake8 file in the root folder.
- Variables should be named in
snake_case
. - Functions should be named in
snake_case
too.1- Getters usually start with
get
. - Checkers usually start with
is
.
- Getters usually start with
- Constants should be named using
ALL_CAPS_SNAKE_CASE
. - Classes should be named in
UppercaseWords
.
Imports are grouped by blank lines in these categories: builtins, externals, discord stuff, and internals. In these groups, we sort by:
- import vs. from
- in order of A-Z
- in order of deepness
Multi-import lines (e.g.: from sizebot.lib.constants import emojis, ids
) should be in alphabetical order.
Example:
import builtins
import inspect
import itertools
import logging
import math
from copy import copy
import toml
import discord
from sizebot import conf
from sizebot.lib import userdb, utils
from sizebot.lib.constants import emojis, ids
from sizebot.lib.digidecimal import Decimal
from sizebot.lib.objs import objects
from sizebot.lib.units import Mult, SV, WV, TV
If you aren't passing in anything to an Exception, don't put () at the end of it.
raise ThisShouldNeverHappenException
raise GuildNotFoundException(1234567890)
1 Much to DigiDuncan's dismay.