tower_data.py
File tower_data.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import copy
import csv
import json
import operator
import os
Function format_output
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def format_output(self, guild, color, channel, prefix='!', _range=None, shortened=False):
Function download_from_taran
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def download_from_taran(self, message, map_name, version, token=''):
Function set_scroll
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def set_scroll(self, guild, channel, floor, room, scroll):
Function format_whole_floor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def format_whole_floor(self, floor: int, guild_data, floor_data, shortened: bool):
Function make_floors_numeric
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def make_floors_numeric(self):
for guild in self.__data.keys():
for channel in self.__data[guild].keys():
# FIXME split up config and tower data, so those checks can be removed
if isinstance(self.__data[guild][channel], dict) and all(
- 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 edit_floor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def edit_floor(self, message, floor, room, scroll):
"""
:rtype: tuple[bool, str]
"""
- 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
Avoid too many return
statements within this function. Open
Open
return True, f'Replaced floor {floor} room {room_display} to {scroll_new_display} (was {scroll_old_display})'
Avoid too many return
statements within this function. Open
Open
return True, f'Set floor {floor} room {room_display} to {scroll_new_display}'
Avoid too many return
statements within this function. Open
Open
return False, f'Couldn\'t find scroll `{scroll}`.'
Avoid too many return
statements within this function. Open
Open
return True, '-'
invalid syntax (<unknown>, line 315)</unknown> Open
Open
if unlock_rooms := [
- Read upRead up
- Exclude checks
Used when a syntax error is raised for a module.