failmap/admin

View on GitHub

Showing 267 of 577 total issues

Function clean_for_organization has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def clean_for_organization(self):
        if not self.contest:
            raise ValidationError("You're not in a contest", "no_contest")

        # mandatory check is done elsewhere.
Severity: Minor
Found in websecmap/game/forms.py - About 35 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

Function generate_certificate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def generate_certificate(failure_mode: str = ""):
    # Code taken from https://cryptography.io/en/latest/x509/reference/

    one_day = datetime.timedelta(1, 0, 0)
    # weak key size, to make test faster
Severity: Minor
Found in websecmap/scanners/tests/test_autoexplain.py - About 35 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

Function get_ipv6 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_ipv6(url: str):
    # https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
    ipv6 = ""

    try:
Severity: Minor
Found in websecmap/scanners/scanner/http.py - About 35 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

Function store_url_ips has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def store_url_ips(url: int, ips):
    """
    Todo: method should be stored in manager

    Be sure to give all ip's that are currently active in one call. Mix IPv4 and IPv6.
Severity: Minor
Found in websecmap/scanners/scanner/http.py - About 35 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

Function match_organization has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def match_organization(openstreetmap_properties, country, organization_type):

    # in preferred order:
    attempted_properties = ["name", "official_name", "alt_name", "localname"]

Severity: Minor
Found in websecmap/map/logic/openstreetmap.py - About 35 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

Function recreate_organization_reports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def recreate_organization_reports(organizations: List[int]):
    """Remove organization rating and rebuild a new."""

    # todo: only for allowed organizations...

Severity: Minor
Found in websecmap/map/report.py - About 35 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

Function get_severity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_severity(scan: Union[EndpointGenericScan, UrlGenericScan]) -> Dict[str, Any]:
    # Can be probably more efficient by adding some methods to scan.
    if not calculation_methods.get(scan.type, None):
        raise ValueError("No calculation available for this scan type: %s" % scan.type)

Severity: Minor
Found in websecmap/reporting/severity.py - About 35 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

Function do_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def do_request(url, params={}, previous_items=[]):
    """Internal function, performs API requests and merges paginated data"""
    # default to max limit of API
    if "limit" not in params.keys():
        params["limit"] = 10000
Severity: Minor
Found in websecmap/api/apis/zorgkaart.py - About 35 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

Function handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def handle(self, *args, **options):
        """Short hand for the first time running this"""

        if options["days"]:
            days = options["days"]
Severity: Minor
Found in websecmap/map/management/commands/custom_commands.py - About 35 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 too many return statements within this function.
Open

        return False
Severity: Major
Found in websecmap/scanners/scanner/autoexplain_dutch_untrusted_cert.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return True
    Severity: Major
    Found in websecmap/scanners/scanner/http.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return False
      Severity: Major
      Found in websecmap/scanners/scanner/autoexplain_dutch_untrusted_cert.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return True
        Severity: Major
        Found in websecmap/scanners/scanner/http.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return "UNKNOWN"
          Severity: Major
          Found in websecmap/scanners/scanner/security_headers.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return False
            Severity: Major
            Found in websecmap/scanners/scanner/autoexplain_dutch_untrusted_cert.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return False
              Severity: Major
              Found in websecmap/scanners/scanner/internet_nl_v2_websecmap.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return True
                Severity: Major
                Found in websecmap/scanners/scanner/http.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return
                  Severity: Major
                  Found in websecmap/scanners/scanner/ftp.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return True
                    Severity: Major
                    Found in websecmap/scanners/impact.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return False
                      Severity: Major
                      Found in websecmap/scanners/scanner/autoexplain_dutch_untrusted_cert.py - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language