Showing 5 of 5 total issues
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self,
Blank line contains whitespace Open
Open
- Read upRead up
- Exclude checks
Trailing whitespace is superfluous.
The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.
Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n \n bang = 12
Function "get_contact_list" has 9 parameters, which is greater than the 7 authorized. Open
Open
async def get_contact_list(connection: ConnectionManager,
fields: List[str] = None,
first_name: str = None,
last_name: str = None,
full_name: str = None,
- Read upRead up
- Exclude checks
A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.
Noncompliant Code Example
With a maximum number of 4 parameters:
def do_something(param1, param2, param3, param4, param5): ...
Compliant Solution
def do_something(param1, param2, param3, param4): ...
Refactor this function to reduce its Cognitive Complexity from 57 to the 15 allowed. Open
Open
async def update_contact(connection: ConnectionManager,
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Function "update_contact" has 28 parameters, which is greater than the 7 authorized. Open
Open
async def update_contact(connection: ConnectionManager,
contact_id: str,
person_types: List[str],
person_id: dict = None,
first_name: str = None,
- Read upRead up
- Exclude checks
A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.
Noncompliant Code Example
With a maximum number of 4 parameters:
def do_something(param1, param2, param3, param4, param5): ...
Compliant Solution
def do_something(param1, param2, param3, param4): ...