iScrE4m/IdiotechDiscordBot

View on GitHub

Showing 9 of 31 total issues

File games.py has 335 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import logging
import bs4
import requests
import json
Severity: Minor
Found in cogs/games.py - About 4 hrs to fix

Function find_value has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def find_value(stats, name):
    """
    :param stats: stats list
    :param name: name of value to find (i.e. Games Won)
    :return: largest value for name (there are multiple game won's but the biggest will be the overall games won
Severity: Minor
Found in cogs/games.py - About 2 hrs 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 check_swears has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def check_swears(self, message, content):
        swear_count = 0
        message_words = content.split()
        for bad_word in Swear.swears:
            bad_word = bad_word.strip()
Severity: Minor
Found in cogs/swear.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

Avoid deeply nested control flow statements.
Open

                    if str(login) != "Normal" and str(community) != "Normal" and str(economy) != "Normal":
                        reply = "Steam might be having some issues, use `!steam status! for more info."
                    # elif login is "normal" and community is "normal" and economy is "normal":
                    #    reply = "Steam is running fine - no issues detected, use `!steam status! for more info."
                    else:
Severity: Major
Found in cogs/games.py - About 45 mins to fix

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

    def __init__(self, game, countdown, channel, owner, bot):
Severity: Minor
Found in cogs/giveaway.py - About 35 mins to fix

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

def create_msg(game, days, hrs, mins, maxlen):
Severity: Minor
Found in helpers/time_calculations.py - About 35 mins to fix

Function release_dates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def release_dates(self, game_list):
        dates = {}
        for release_date in game_list:
            name = release_date
            hour = 0
Severity: Minor
Found in cogs/games.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

Function get_total has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_total(self, table):
        if table is "ga":
            all = self.db.query(GiveawaysDB).all()
            total = 0
            for one in all:
Severity: Minor
Found in cogs/stats.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

Function stomp_confusables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def stomp_confusables(input_string):
    output_string = ""
    for char in input_string:
        for confusable_line in Swear.confusables:
            if char in confusable_line:
Severity: Minor
Found in cogs/swear.py - About 25 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