Showing 30 of 124 total issues
Avoid deeply nested control flow statements. Open
if ( # spellcheck
spellcheck(common, bird, 4) or spellcheck(sci_name, bird, 4)
) and ( # ensure that it's a species by checking for binomial name
" " in sci_name
):
Function format_wiki_url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def format_wiki_url(ctx, bird: str = None) -> str:
logger.info("fetching wiki url")
if bird is None:
bird = ctx
user_id = 0
- 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 to_int
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_int(self):
"""Convert filters into an integer representation.
This is calculated with a 48 digit binary number representing the 48 filter options.
"""
- 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
Avoid deeply nested control flow statements. Open
if not block:
break
out_file.write(block)
Function from_int
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def from_int(cls, number: int):
"""Convert an int to a filter object."""
if number >= 2**48 or number < 0:
raise ValueError("Input number out of bounds.")
me = cls()
- 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 content_type_lookup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def content_type_lookup(cls, content_type: str) -> Optional[str]:
for media in cls:
for content, ext in media.types().items():
if content_type == content:
return ext
- 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 _state_lists
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _state_lists():
"""Converts txt files of state data into lists."""
filenames = ("birdList", "songBirds", "aliases")
states_: Dict[str, Dict[str, List[str]]] = {}
state_names = os.listdir("bot/data/state")
- 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 incorrect_increment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def incorrect_increment(ctx, bird: str, amount: int):
"""Increments the value of an incorrect bird by `amount`.
`ctx` - Discord context object or user id\n
`bird` - bird that was incorrect\n
- 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 __call__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, ctx: commands.Context):
if (
ctx.command.name
in (
"bird",
- 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 streak_increment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def streak_increment(ctx, amount: int):
"""Increments the streak of a user by `amount`.
`ctx` - Discord context object or user id\n
`amount` (int) - amount to increment by, usually 1.
- 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"