meetbryce/open-source-slack-ai

View on GitHub

Showing 5 of 5 total issues

File utils.py has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import re
import uuid
from time import mktime, gmtime, strptime
import calendar
Severity: Minor
Found in ossai/utils.py - About 3 hrs to fix

    Function get_name_from_id has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    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:
    Severity: Minor
    Found in ossai/utils.py - About 1 hr to fix

    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

    def summarize(
    Severity: Minor
    Found in ossai/summarizer.py - About 35 mins to fix

      Function summarize_slack_messages has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def summarize_slack_messages(
      Severity: Minor
      Found in ossai/summarizer.py - About 35 mins to fix

        Function catch_errors_dm_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        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"
        
        
        Severity: Minor
        Found in ossai/decorators/catch_error_dm_user.py - About 35 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language