Showing 84 of 278 total issues
File search.py
has 1480 lines of code (exceeds 250 allowed). Consider refactoring. Open
import calendar
import copy
import datetime
import importlib
import json
File command_registry.py
has 1271 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import re
from enum import Enum
import aiohttp
File bot.py
has 1031 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
import asyncio
import datetime
import json
import operator
File game_data.py
has 960 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import math
import operator
import re
TeamExpander
has 84 functions (exceeds 20 allowed). Consider refactoring. Open
class TeamExpander:
my_emojis = {}
def __init__(self):
world = GameData()
File views.py
has 610 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import math
import discord
from jinja2 import Environment, FileSystemLoader
GameData
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
class GameData:
def __init__(self):
self.data = None
self.user_data = {
Function populate_weekly_event_details
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def populate_weekly_event_details(self):
def extract_restrictions(raw_data):
restrictions = raw_data.get('PlayerTeamRestrictions', {})
- 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
File tower_data.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
import csv
import json
import operator
import os
Function populate_traitstones
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def populate_traitstones(self):
for traits in self.user_data['pTraitsTable']:
runes = self.extract_runes(traits['Runes'])
for rune in runes:
if rune['name'] in self.traitstones:
- 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 populate_spells
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def populate_spells(self):
for spell in self.data['Spells']:
spell_effects = []
boost = 0
last_type = ""
- 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 word_wrap
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def word_wrap(image, draw, text, roi_width, roi_height):
"""Break long text to multiple lines, and reduce point size
until all text fits within a bounding box."""
mutable_message = text
iteration_attempts = 100
- 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 matches
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def matches(self, search_term, lang, **kwargs):
compacted_search = extract_search_tag(search_term)
item = self.translations[lang]
if item.name == '`?`':
return False
- 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
File graphic_soulforge_preview.py
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import io
import math
from typing import Mapping
from wand.color import Color
Function search_item
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def search_item(search_term, lang, items, lookup_keys, translator, sort_by='name'):
if search_term.startswith('#'):
search_term = search_term[1:]
if search_term.isdigit():
if item := items.get(int(search_term)):
- 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 populate_drop_chances
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def populate_drop_chances(self):
for chest_id, chest in self.user_data['ChestInfo'].items():
if len(chest_id) != 1:
continue
drop_chances = chest['DropChances']
- 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
File base_bot.py
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import logging
import os
import sys
import traceback
Function get_event_rewards
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_event_rewards(self, event, lang):
for stage, stage_reward in event['rewards'].items():
stage_reward['name'] = _('[REWARD_N]', lang).replace('%1', str(stage))
if EVENT_TYPES[event['type']] == '[RAIDBOSS]':
if stage <= 2:
- 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 get_current_event
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_current_event(self, lang, emojis):
event = copy.deepcopy(self.weekly_event)
kingdoms = self.search_kingdom(event['kingdom_id'], lang)
if kingdoms:
event['kingdom'] = kingdoms[0]
- 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 translate_spoiler
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def translate_spoiler(self, spoiler, lang):
# this is transitional until all new models are in place.
if spoiler['type'] in ['pet']:
if item := getattr(self, spoiler['type'] + 's').get(spoiler['id']):
entry = item[translations.LANGUAGE_CODE_MAPPING.get(lang, lang)].data.copy()
- 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"