Showing 5 of 5 total issues
Function __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def __init__(self, url):
url_object = urlparse(url)
self.url = url_object.geturl()
self.scheme = url_object.scheme
self.error = 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
Avoid deeply nested control flow statements. Open
Open
if len(results) > 0:
print("!!! %s additional scripts found, use '-v' for more details\n" % (len(results)))
if args.verbose:
print("!!! Injected scripts:")
for result in results:
Avoid deeply nested control flow statements. Open
Open
if len(results) > 0:
print("!!! %s additional inline scripts found, use '-v' for more details\n" % (len(results)))
if args.verbose:
print("!!! The following inline scripts are inserted on this mirror:")
for result in results:
Avoid deeply nested control flow statements. Open
Open
if not mirror:
print("-> %s does not exist in data file, skipping ...\n" % url)
# Skip if <title> between original and mirror does not match
elif original.title[:10] not in mirror.title:
pass
Function populate_database_with_mirrors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def populate_database_with_mirrors(urls, db):
counter = 1
for url in urls:
print("-> Retrieving website (%s/%s): %s" % (counter, len(urls), url))
# Create website Object
- 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"