Config¶
Defaults¶
Constants with default values for plugin’s configuration.
We try to stick to “the magical 7 ± 2 number”. https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two
What does it mean? It means that we choose these values based on our mind capacity. And it is really hard to keep in mind more that 9 objects at the same time.
These values can be changed in the setup.cfg
file on a per-project bases,
if you find them too strict or too permissive.
-
MIN_NAME_LENGTH
= 2¶ Minimum variable’s name length.
-
MAX_NAME_LENGTH
= 45¶ Maximum variable and module name length:
-
I_CONTROL_CODE
= True¶ Whether you control ones who use your code.
-
MAX_RETURNS
= 5¶ Maximum number of return statements allowed in a single function.
-
MAX_LOCAL_VARIABLES
= 5¶ Maximum number of local variables in a function.
-
MAX_EXPRESSIONS
= 9¶ Maximum number of expressions in a single function.
-
MAX_ARGUMENTS
= 5¶ Maximum number of arguments for functions or methods.
-
MAX_MODULE_MEMBERS
= 7¶ Maximum number of classes and functions in a single module.
-
MAX_METHODS
= 7¶ Maximum number of methods in a single class.
-
MAX_LINE_COMPLEXITY
= 14¶ Maximum line complexity.
-
MAX_JONES_SCORE
= 12¶ Maximum median module Jones complexity.
-
MAX_IMPORTS
= 12¶ Maximum number of imports in a single module.
-
MAX_BASE_CLASSES
= 3¶ Maximum number of base classes.
-
MAX_DECORATORS
= 5¶ Maximum number of decorators.
Plugins¶
It is also important to configure different plugins that we ship with this module.
[flake8]
max-complexity = 6
max-line-length = 80
enable-extensions = G
Place this configuration inside setup.cfg
file.
Our repository contains
the fully working example.
We also use flake8-isort
to style our imports.
You will need to update your configuration with the following lines:
[isort]
multi_line_output = 3
include_trailing_comma = true
default_section = FIRSTPARTY
line_length = 80
Otherwise, your isort
will complain about your imports.
We are working hard to remove any kind of configuration from this tool. Please, be calm!