Root.Smell.MethodSmell |
Parent | Index |
Sibling aspects | ClassSmell | Complexity | Naming |
This aspect detects code smells related to methods' and functions definitions in your codebase.
Method-level code smells indicate poorly defined method and or functions (too long method or functions, or functions with too many parameters) in your source code.
Taste | Meaning | Values |
---|---|---|
max_method_length |
Represents the max number of lines for a method or a function'sdefinition. | 40 |
max_parameters |
Represents the max number of parameters for a function's. | 10, 5 |
* bold denotes default value
This aspect does not have any sub aspects.
# This function has way too many parameters
def func(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, z):
pass
Make your functions and methods unambiguous, easy to read and debug by reducing the number of parameters and length of your methods and functions.
A fix for this would simply consist of redefining the functions (and or method), making them shorter and reducing the number of parameters (maybe by creating more functions or using libraries).