maduck/GoWDiscordTeamBot

View on GitHub

Showing 281 of 281 total issues

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

    def __task_name_replacements(self, task, color, lang):
        replacements = {
            '{WeaponType}': '[WEAPONTYPE_{c:u}]',
            '{Kingdom}': '[{d:u}_NAME]',
            '{Banner}': '[{c:u}_BANNERNAME]',
Severity: Minor
Found in search.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

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

    def populate_troop_release_dates(self):
        release: dict
        for release in self.user_data['pEconomyModel']['TroopReleaseDates']:
            troop_id = release['TroopId']
            release_date = self.get_datetime(release['Date'])
Severity: Minor
Found in data_source/game_data.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

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

    def translate_weapon(self, weapon, lang):
        weapon['name'] = _(weapon['name'], lang)
        weapon['description'] = _(weapon['description'], lang)
        weapon['color_code'] = "".join(sorted(weapon['colors']))
        weapon['spell_title'] = _('[TROOPHELP_SPELL0]', lang)
Severity: Minor
Found in search.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

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

    def translate_toplist(self, toplist_id, lang):
        toplist = self.toplists.get(toplist_id)
        if not toplist:
            return None
        result = toplist.copy()
Severity: Minor
Found in search.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

Line too long (109/100)
Open

                'description': 'Date of weapon release, format MONTH-DAY with two digits each (e.g. 12-25). '
Severity: Info
Found in command_registry.py by pylint

Used when a line is longer than a given number of characters.

Too many arguments (7/5)
Open

    def __init__(self, author, guild, channel, content, interaction_id=None, interaction_token=None):
Severity: Info
Found in discord_fake_classes.py by pylint

Used when a function or method takes too many arguments.

TODO adapt to something more strict, maybe this?
Open

        # TODO adapt to something more strict, maybe this?
Severity: Minor
Found in command_registry.py by pylint

Used when a warning note as FIXME or XXX is detected.

Line too long (107/100)
Open

                return await add_slash_command(bot_id, bot_token, guild_id, cmd_name, description, options)
Severity: Info
Found in command_registry.py by pylint

Used when a line is longer than a given number of characters.

Missing module docstring
Open

import asyncio
Severity: Info
Found in command_registry.py by pylint

Used when a module has no docstring.Empty modules do not require a docstring.

Constant name aliases doesn't conform to UPPER_CASE naming style
Open

aliases = {
Severity: Info
Found in command_registry.py by pylint

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Variable name x doesn't conform to snake_case naming style
Open

                x, y = kingdom['coordinates']
Severity: Info
Found in graphic_map.py by pylint

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Missing module docstring
Open

from game_constants import TROOP_RARITIES
Severity: Info
Found in event_helpers.py by pylint

Used when a module has no docstring.Empty modules do not require a docstring.

Wrong hanging indentation (remove 4 spaces).
Open

                    + r'(?P<prefix>.)tower (?P<floor>\d+) (?P<scroll_ii>[^ ]+) (?P<scroll_iii>[^ ]+) '
Severity: Info
Found in command_registry.py by pylint

TODO + r'(?P<prefix>.)tower (?P<floor>d+) (?P<scroll_ii>[^ ]+) (?P<scroll_iii>[^ ]+) ' | ^</scroll_iii></scroll_ii></floor></prefix>

Line too long (120/100)
Open

        # \[(?P<weapon_troops>([167]\d{3},?)+){1,4}(?P<banner>3\d{3},?)?(?P<talents>([0-3]{1},?){7})?(?P<class>\d{5})?\]
Severity: Info
Found in command_registry.py by pylint

Used when a line is longer than a given number of characters.

Missing module docstring
Open

import io
Severity: Info
Found in graphic_map.py by pylint

Used when a module has no docstring.Empty modules do not require a docstring.

Unable to import 'wand.color'
Open

from wand.color import Color
Severity: Critical
Found in graphic_map.py by pylint

Used when pylint has been unable to import a module.

Variable name y doesn't conform to snake_case naming style
Open

                x, y = kingdom['coordinates']
Severity: Info
Found in graphic_map.py by pylint

Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

Missing function or method docstring
Open

    def send(self, *args, **kwargs):
Severity: Info
Found in discord_fake_classes.py by pylint

Used when a function or method has no docstring.Some special methods like init do not require a docstring.

Line too long (119/100)
Open

    filenames = LANG_FILES + ['World.json', 'User.json', 'Campaign.json', 'Soulforge.json', 'Event.json', 'Store.json']
Severity: Info
Found in bot_tasks.py by pylint

Used when a line is longer than a given number of characters.

Line too long (101/100)
Open

            f'^{LANG_PATTERN}(?P<prefix>.)tower (?P<floor>[^ ]+) (?P<room>[^ ]+) (?P<scroll>[^ ]+)$',
Severity: Info
Found in command_registry.py by pylint

Used when a line is longer than a given number of characters.

Severity
Category
Status
Source
Language