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
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
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
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
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
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
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
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
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.
- Read upRead up
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
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
- Read upRead up
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
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,
- Read upRead up
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)
- Read upRead up
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__(
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.
- Read upRead up
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():
- Read upRead up
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.
- Read upRead up
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"]
- Read upRead up
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(