Showing 267 of 577 total issues
Function reorder
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def reorder(self, request, queryset):
first_order = None
for configuration in queryset:
- 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 (
endpoint_rating["type"] in desired_endpoint_scans
and endpoint_rating.get("comply_or_explain_valid_at_time_of_report", False) is False
):
high += endpoint_rating["high"]
Avoid deeply nested control flow statements. Open
Open
for endpoint in url["endpoints"]:
# Only add the endpoint once for a series of ratings. And only if the
# ratings is not a repeated finding.
added_endpoint = False
Function compose_task
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def compose_task(
organizations_filter: dict = dict(),
urls_filter: dict = dict(),
endpoints_filter: dict = dict(),
) -> Task:
- 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 scan_type in PUBLISHED_SCAN_TYPES:
vs.urls = measurement[scan_type]["applicable_urls"]
vs.endpoints = measurement[scan_type]["applicable_endpoints"]
else:
# total
Avoid deeply nested control flow statements. Open
Open
if scan.type in ENDPOINT_SCAN_TYPES:
these_endpoint_scans[scan.type] = scan
# enrich the ratings with previous ratings, without overwriting them.
for endpoint_scan_type in ENDPOINT_SCAN_TYPES:
Avoid deeply nested control flow statements. Open
Open
for r in url["ratings"]:
# stats over all different ratings
if r["type"] not in measurement["explained"]:
measurement["explained"][r["type"]] = {}
measurement["explained"][r["type"]]["total"] = 0
Function merge
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def merge(
Function store_when_new_or_kill_if_gone
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def store_when_new_or_kill_if_gone(connected, url, port, protocol, ip_version):
Function can_connect
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def can_connect(self, protocol: str, url: str, port: int, ip_version: int) -> bool:
Function kill_endpoint
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def kill_endpoint(protocol: str, url_id: int, port: int, ip_version: int, origin: str = ""):
Function create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create(cls, task: celery.Task, name: str, request, *args, **kwargs) -> "Job":
Function store_endpoint_scan_result
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def store_endpoint_scan_result(scan_type: str, endpoint_id: int, rating: str, message: str, evidence: str = ""):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, verbosity=1, failfast=False, keepdb=False, pdb=False, **kwargs):
Function save_endpoint
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def save_endpoint(protocol: str, url_id: int, port: int, ip_version: int, origin: str = ""):
Function dissolve
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def dissolve(
Function retrieve_endpoints_from_urls
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def retrieve_endpoints_from_urls(
Function store_url_scan_result
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def store_url_scan_result(scan_type: str, url_id: int, rating: str, message: str, evidence: str = ""):
Function add_url_to_new_organization
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_url_to_new_organization(country: str, organization_type: str, target_organization_name, url, when):
Function map_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def map_data(