ocean_provider/utils/url.py
Function get_redirect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_redirect(url, redirect_count=0):
if not is_url(url):
return None
if redirect_count > 5:
- 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 validate_dns_record
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate_dns_record(record, domain, record_type):
value = record if isinstance(record, str) else record.to_text().strip()
allow_non_public_ip = bool_value_of_env("ALLOW_NON_PUBLIC_IP")
try:
- 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 too many return
statements within this function. Open
Open
return url
Avoid too many return
statements within this function. Open
Open
return get_redirect(location, redirect_count + 1)