benrucker/discord-jerma

View on GitHub

Showing 5 of 5 total issues

File guild_sounds.py has 388 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import random
import time
from typing import Optional

Severity: Minor
Found in jerma/cogs/guild_sounds.py - About 5 hrs to fix

    File admin.py has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import io
    import random
    import subprocess
    import sys
    import textwrap
    Severity: Minor
    Found in jerma/cogs/admin.py - About 3 hrs to fix

      File fun.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import asyncio
      import os
      import pickle
      import random
      import time
      Severity: Minor
      Found in jerma/cogs/fun.py - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                if self.user_joined_channel(before, after) and not member.voice.afk:
                    await self.play_join_sound(member, old_vc)
                elif old_vc and self.old_voice_channel_has_no_people(old_vc):
                    await self.disconnect_from_voice(old_vc)
                elif old_vc and self.user_left_channel(before, after) and before.channel == old_vc.channel:
        Severity: Major
        Found in jerma/cogs/guild_sounds.py - About 1 hr to fix

          Function mixed_lang_to_katakana has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def mixed_lang_to_katakana(text: List[str]) -> List[str]:
              out = []
              for word in text:
                  match = jpattern.match(word)
                  if match:
          Severity: Minor
          Found in jerma/cogs/utils/textconverter.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

          Severity
          Category
          Status
          Source
          Language