Showing 5 of 5 total issues
File utils.py
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import os
import re
import uuid
from time import mktime, gmtime, strptime
import calendar
Function get_name_from_id
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_name_from_id(client: WebClient, user_or_bot_id: str, is_bot=False) -> str:
"""
Retrieves the name associated with a user ID or bot ID.
Args:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function summarize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def summarize(
Function summarize_slack_messages
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def summarize_slack_messages(
Function catch_errors_dm_user
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def catch_errors_dm_user(func):
@wraps(func)
async def wrapper(client: WebClient, *args, **kwargs):
assert isinstance(client, WebClient), "client must be a Slack WebClient"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"