maduck/GoWDiscordTeamBot

View on GitHub
tower_data.py

Summary

Maintainability
C
1 day
Test Coverage

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
Severity: Minor
Found in tower_data.py - About 3 hrs to fix

    Function format_output has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def format_output(self, guild, color, channel, prefix='!', _range=None, shortened=False):
    Severity: Major
    Found in tower_data.py - About 50 mins to fix

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

          def download_from_taran(self, message, map_name, version, token=''):
      Severity: Minor
      Found in tower_data.py - About 35 mins to fix

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

            def set_scroll(self, guild, channel, floor, room, scroll):
        Severity: Minor
        Found in tower_data.py - About 35 mins to fix

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

              def format_whole_floor(self, floor: int, guild_data, floor_data, shortened: bool):
          Severity: Minor
          Found in tower_data.py - About 35 mins to fix

            Function make_floors_numeric has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            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(
            Severity: Minor
            Found in tower_data.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 edit_floor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def edit_floor(self, message, floor, room, scroll):
                    """
                    :rtype: tuple[bool, str]
                    """
            
            
            Severity: Minor
            Found in tower_data.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

            Avoid too many return statements within this function.
            Open

                    return True, f'Replaced floor {floor} room {room_display} to {scroll_new_display} (was {scroll_old_display})'
            Severity: Major
            Found in tower_data.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return True, f'Set floor {floor} room {room_display} to {scroll_new_display}'
              Severity: Major
              Found in tower_data.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return False, f'Couldn\'t find scroll `{scroll}`.'
                Severity: Major
                Found in tower_data.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return True, '-'
                  Severity: Major
                  Found in tower_data.py - About 30 mins to fix

                    invalid syntax (<unknown>, line 315)</unknown>
                    Open

                            if unlock_rooms := [
                    Severity: Critical
                    Found in tower_data.py by pylint

                    Used when a syntax error is raised for a module.

                    There are no issues that match your filters.

                    Category
                    Status