itsVale/Vale.py

View on GitHub

Showing 43 of 43 total issues

File starboard.py has 949 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import collections
import datetime
import logging
import re
Severity: Major
Found in cogs/utility/starboard.py - About 2 days to fix

    File moderation.py has 759 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import asyncio
    import contextlib
    import datetime
    import functools
    import heapq
    Severity: Major
    Found in cogs/moderation/moderation.py - About 1 day to fix

      File modlog.py has 538 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import asyncio
      import collections
      import contextlib
      import enum
      import json
      Severity: Major
      Found in cogs/moderation/modlog.py - About 1 day to fix

        File sudoku.py has 450 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import asyncio
        import enum
        import functools
        import itertools
        import random
        Severity: Minor
        Found in cogs/games/sudoku.py - About 6 hrs to fix

          File permissions.py has 364 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import itertools
          import random
          from collections import defaultdict, namedtuple
          
          import asyncpg
          Severity: Minor
          Found in cogs/config/permissions.py - About 4 hrs to fix

            File bot.py has 348 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import asyncio
            import collections
            import contextlib
            import importlib
            import inspect
            Severity: Minor
            Found in core/bot.py - About 4 hrs to fix

              File paginator.py has 322 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import asyncio
              import collections
              import contextlib
              import functools
              import itertools
              Severity: Minor
              Found in utils/paginator.py - About 3 hrs to fix

                File currency.py has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import collections
                import enum
                import io
                import math
                import random
                Severity: Minor
                Found in cogs/fun/currency.py - About 3 hrs to fix

                  Function jumps_from has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def jumps_from(self, square):
                          """Generates all jumps from a particular square in the current position."""
                  
                          board = self._board
                          captures = _CAPTURES[board[square]]
                  Severity: Minor
                  Found in cogs/games/checkers.py - About 3 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

                  ValePy has 26 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ValePy(commands.AutoShardedBot):
                      __version__ = '0.0.2a'
                      version_info = VersionInfo(major=0, minor=0, micro=2, releaselevel='alpha', serial=0)
                  
                      def __init__(self):
                  Severity: Minor
                  Found in core/bot.py - About 3 hrs to fix

                    File base.py has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import asyncio
                    import contextlib
                    import enum
                    import functools
                    import inspect
                    Severity: Minor
                    Found in cogs/games/base.py - About 2 hrs to fix

                      Function _load_emojis has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _load_emojis(self):
                              import emoji
                      
                              emoji_cache = {}
                      
                      
                      Severity: Minor
                      Found in core/bot.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 cache has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def cache(max_size=128, make_key=default_key):
                          def decorator(func):
                              if max_size is None:
                                  cache = {}
                                  get_stats = lambda: (0, 0)
                      Severity: Minor
                      Found in utils/cache.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

                      File help.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import copy
                      import inspect
                      import itertools
                      import operator
                      import random
                      Severity: Minor
                      Found in utils/help.py - About 2 hrs to fix

                        File tags.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import itertools
                        import logging
                        
                        import asyncpg
                        import discord
                        Severity: Minor
                        Found in cogs/utility/tags.py - About 2 hrs to fix

                          Function __init_subclass__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def __init_subclass__(cls, stop_emoji='\N{BLACK SQUARE FOR STOP}', stop_pattern=None, stop_fallback='exit', **kwargs):
                                  super().__init_subclass__(**kwargs)
                                  cls._reaction_map = callbacks = collections.OrderedDict()
                          
                                  cls._message_callbacks = message_callbacks = []
                          Severity: Minor
                          Found in utils/paginator.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 _changelog_versions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def _changelog_versions(lines):
                              version = change_type = release_date = None
                              changes = {}
                              for line in lines:
                                  line = line.strip()
                          Severity: Minor
                          Found in cogs/general/meta.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

                          Function get_example has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def get_example(converter, ctx):
                              """Returns a random example based on the converter."""
                          
                              if hasattr(converter, 'random_example'):
                                  return converter.random_example(ctx)
                          Severity: Minor
                          Found in utils/examples.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

                          Function _parameter_examples has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def _parameter_examples(parameters, ctx, command=None):
                              command = command or ctx.command
                          
                              def parameter_example(parameter):
                                  ctx._current_parameter = parameter
                          Severity: Minor
                          Found in utils/examples.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

                          Function _make_board has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def _make_board(m=3):
                              """Returns a randomly filled m**2 x m**2 Sudoku board."""
                          
                              n = m * m
                              nn = n * n
                          Severity: Minor
                          Found in cogs/games/sudoku.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

                          Severity
                          Category
                          Status
                          Source
                          Language