tctree333/Bird-ID

View on GitHub

Showing 30 of 124 total issues

File functions.py has 745 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# functions.py | function definitions
# Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Severity: Major
Found in bot/functions.py - About 1 day to fix

    File core.py has 573 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # core.py | core media fetching functions
    # Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm
    
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    Severity: Major
    Found in bot/core.py - About 1 day to fix

      File filters.py has 467 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # filters.py | Macaulay Library filter representation functions
      # Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm
      
      # This program is free software: you can redistribute it and/or modify
      # it under the terms of the GNU General Public License as published by
      Severity: Minor
      Found in bot/filters.py - About 7 hrs to fix

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

        # stats.py | commands for bot statistics
        # Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm
        
        # This program is free software: you can redistribute it and/or modify
        # it under the terms of the GNU General Public License as published by
        Severity: Minor
        Found in bot/cogs/stats.py - About 6 hrs to fix

          File score.py has 446 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # score.py | commands to show score related things
          # Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm
          
          # This program is free software: you can redistribute it and/or modify
          # it under the terms of the GNU General Public License as published by
          Severity: Minor
          Found in bot/cogs/score.py - About 6 hrs to fix

            File get_birds.py has 401 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # get_birds.py | commands for getting bird images or songs
            # Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm
            
            # This program is free software: you can redistribute it and/or modify
            # it under the terms of the GNU General Public License as published by
            Severity: Minor
            Found in bot/cogs/get_birds.py - About 5 hrs to fix

              File state.py has 371 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # state.py | commands for state specific birds
              # Copyright (C) 2019-2021  EraserBird, person_v1.32
              
              # This program is free software: you can redistribute it and/or modify
              # it under the terms of the GNU General Public License as published by
              Severity: Minor
              Found in bot/cogs/state.py - About 4 hrs to fix

                File other.py has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # other.py | misc. commands
                # Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm
                
                # This program is free software: you can redistribute it and/or modify
                # it under the terms of the GNU General Public License as published by
                Severity: Minor
                Found in bot/cogs/other.py - About 4 hrs to fix

                  Function cache has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def cache(pre=None, local=True):
                      """Cache decorator based on functools.lru_cache.
                  
                      This is not a very good cache, but it "works" for our
                      purposes.
                  Severity: Minor
                  Found in bot/functions.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

                  File race.py has 296 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # race.py | commands for racing/competition
                  # Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm
                  
                  # This program is free software: you can redistribute it and/or modify
                  # it under the terms of the GNU General Public License as published by
                  Severity: Minor
                  Found in bot/cogs/race.py - About 3 hrs to fix

                    Function bird_setup has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def bird_setup(ctx, bird: str):
                        """Sets up a new bird for incorrect tracking.
                    
                        `ctx` - Discord context object or user id\n
                        `bird` - bird to setup
                    Severity: Minor
                    Found in bot/data_functions.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

                    File sessions.py has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # sessions.py | commands for sessions
                    # Copyright (C) 2019-2021  EraserBird, person_v1.32, hmmm
                    
                    # This program is free software: you can redistribute it and/or modify
                    # it under the terms of the GNU General Public License as published by
                    Severity: Minor
                    Found in bot/cogs/sessions.py - About 2 hrs to fix

                      Function build_id_list has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def build_id_list(
                          user_id: str = None,
                          taxon: Union[list, str] = None,
                          state: Union[list, str] = None,
                          media_type: MediaType = MediaType.IMAGE,
                      Severity: Minor
                      Found in bot/functions.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 parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def parse(cls, args: str, defaults: bool = True, use_numbers: bool = True):
                              """Parse an argument string as Macaulay Library media filters."""
                              me = cls()
                              me._clear()  # reset existing filters to empty
                              lookup = me.aliases(lookup=True)
                      Severity: Minor
                      Found in bot/filters.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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(
                      Severity: Major
                      Found in bot/filters.py - About 1 hr to fix

                        Function _validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _validate(self) -> bool:
                                """Check the validity of Filter values.
                        
                                Return True if Filter values are valid.
                                Raises a ValueError if Filter values are invalid.
                        Severity: Minor
                        Found in bot/filters.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 display has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def display(self):
                                """Return a list describing the filters."""
                                output = []
                                display = self.aliases(display_lookup=True)
                                for title, values in self.__dict__.items():
                        Severity: Minor
                        Found in bot/filters.py - About 55 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 url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def url(
                                self, taxon_code: str, media_type: MediaType, count: int, cursor: str = ""
                            ) -> str:
                                """Generate the search url based on the filters.
                        
                        
                        Severity: Minor
                        Found in bot/filters.py - About 55 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 getLocations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def getLocations(self, rank_by: str = None, rank_amount: int = None):
                                data = None
                                world = [
                                    item
                                    for item in self._request("/v2/locations", {"source": "jhu"})["locations"]
                        Severity: Minor
                        Found in bot/cogs/covid.py - About 45 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 error_handle has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def error_handle(
                        Severity: Minor
                        Found in bot/cogs/get_birds.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language