Showing 3 of 3 total issues
Function generate_downloader
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def generate_downloader(headers: Dict[str, str], args: Any, max_per_hour: int=30
) -> Callable[..., None]:
"""Create function to download with rate limiting and text progress."""
def _downloader(url: str, dest: str) -> None:
- 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 rate_limited
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def rate_limited(max_per_hour: int, *args: Any) -> Callable[..., Any]:
"""Decorator to limit function to N calls/hour."""
min_interval = 3600.0 / float(max_per_hour)
def _decorate(func: Callable[..., Any]) -> Callable[..., Any]:
- 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_int_string
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_int_string(int_string: str) -> List[int]:
"""
Given a string like "1 23 4-8 32 1", return a unique list of those integers in the string and
the integers in the ranges in the string.
Non-numbers ignored. Not necessarily sorted
- 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"