failmap/admin

View on GitHub

Showing 267 of 577 total issues

Function reorder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def reorder(self, request, queryset):

        first_order = None

        for configuration in queryset:
Severity: Minor
Found in websecmap/map/admin.py - About 45 mins to fix

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 (
                        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"]
Severity: Major
Found in websecmap/map/logic/map.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    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
    Severity: Major
    Found in websecmap/map/report.py - About 45 mins to fix

      Function compose_task has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def compose_task(
          organizations_filter: dict = dict(),
          urls_filter: dict = dict(),
          endpoints_filter: dict = dict(),
      ) -> Task:
      Severity: Minor
      Found in websecmap/map/report.py - About 45 mins to fix

      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 scan_type in PUBLISHED_SCAN_TYPES:
                              vs.urls = measurement[scan_type]["applicable_urls"]
                              vs.endpoints = measurement[scan_type]["applicable_endpoints"]
                          else:
                              # total
      Severity: Major
      Found in websecmap/map/report.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        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:
        Severity: Major
        Found in websecmap/reporting/report.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          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
          Severity: Major
          Found in websecmap/map/report.py - About 45 mins to fix

            Function merge has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def merge(
            Severity: Minor
            Found in websecmap/organizations/adminstrative_transformations.py - About 35 mins to fix

              Function store_when_new_or_kill_if_gone has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def store_when_new_or_kill_if_gone(connected, url, port, protocol, ip_version):
              Severity: Minor
              Found in websecmap/scanners/scanner/ftp.py - About 35 mins to fix

                Function can_connect has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def can_connect(self, protocol: str, url: str, port: int, ip_version: int) -> bool:
                Severity: Minor
                Found in websecmap/scanners/scanner/http.py - About 35 mins to fix

                  Function kill_endpoint has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def kill_endpoint(protocol: str, url_id: int, port: int, ip_version: int, origin: str = ""):
                  Severity: Minor
                  Found in websecmap/scanners/scanner/http.py - About 35 mins to fix

                    Function create has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def create(cls, task: celery.Task, name: str, request, *args, **kwargs) -> "Job":
                    Severity: Minor
                    Found in websecmap/app/models.py - About 35 mins to fix

                      Function store_endpoint_scan_result has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def store_endpoint_scan_result(scan_type: str, endpoint_id: int, rating: str, message: str, evidence: str = ""):
                      Severity: Minor
                      Found in websecmap/scanners/scanmanager.py - About 35 mins to fix

                        Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def __init__(self, verbosity=1, failfast=False, keepdb=False, pdb=False, **kwargs):
                        Severity: Minor
                        Found in websecmap/testrunner.py - About 35 mins to fix

                          Function save_endpoint has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def save_endpoint(protocol: str, url_id: int, port: int, ip_version: int, origin: str = ""):
                          Severity: Minor
                          Found in websecmap/scanners/scanner/http.py - About 35 mins to fix

                            Function dissolve has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def dissolve(
                            Severity: Minor
                            Found in websecmap/organizations/adminstrative_transformations.py - About 35 mins to fix

                              Function retrieve_endpoints_from_urls has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def retrieve_endpoints_from_urls(
                              Severity: Minor
                              Found in websecmap/scanners/plannedscan.py - About 35 mins to fix

                                Function store_url_scan_result has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                def store_url_scan_result(scan_type: str, url_id: int, rating: str, message: str, evidence: str = ""):
                                Severity: Minor
                                Found in websecmap/scanners/scanmanager.py - About 35 mins to fix

                                  Function add_url_to_new_organization has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  def add_url_to_new_organization(country: str, organization_type: str, target_organization_name, url, when):
                                  Severity: Minor
                                  Found in websecmap/organizations/adminstrative_transformations.py - About 35 mins to fix

                                    Function map_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    def map_data(
                                    Severity: Minor
                                    Found in websecmap/map/views.py - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language