failmap/admin

View on GitHub

Showing 267 of 577 total issues

Function internet_nl_requirement_tilde_value_format has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def internet_nl_requirement_tilde_value_format(scan: Union[EndpointGenericScan, UrlGenericScan]):

    # To support old metrics:
    if "~" in scan.rating:
        return internet_nl_api_v1_requirement_tilde_value_format(scan)
Severity: Minor
Found in websecmap/reporting/severity.py - About 1 hr 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 create_health_report has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def create_health_report(outdated: List, good: List, published_scan_types):
    """
    Returns:
        {
            'outdate_period_in_hours': 72,
Severity: Minor
Found in websecmap/map/logic/map_health.py - About 1 hr 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 calculate_map_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def calculate_map_data(days: int = 366, countries: List = None, organization_types: List = None):
    from django.db import OperationalError

    log.info("calculate_map_data")

Severity: Minor
Found in websecmap/map/report.py - About 1 hr 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 test_reflag_endpointgenericscan has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def test_reflag_endpointgenericscan(db):
    u = Url.objects.create(url="basisbeveiliging.nl")
    e = Endpoint.objects.create(protocol="https", port=443, ip_version=4, is_dead=False, url=u)

    # scans for first endpoint
Severity: Minor
Found in websecmap/scanners/tests/test_set_latest_scan.py - About 1 hr to fix

    Function store_check_result has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def store_check_result(
    Severity: Major
    Found in websecmap/scanners/proxy.py - About 1 hr to fix

      Function standard_calculation_for_internet_nl has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def standard_calculation_for_internet_nl(
      Severity: Major
      Found in websecmap/reporting/severity.py - About 1 hr to fix

        Function standard_calculation has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def standard_calculation(
        Severity: Major
        Found in websecmap/reporting/severity.py - About 1 hr to fix

          Function contest_map_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def contest_map_data(request):
              """
              This doesn't have to take in account the time sliding features of failmap.
          
              Just take ANY result from the scans matching it with the is_latest_coordinate. It's already
          Severity: Minor
          Found in websecmap/game/views.py - About 55 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 compose_task has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def compose_task(
              organizations_filter: dict = dict(), urls_filter: dict = dict(), endpoints_filter: dict = dict(), **kwargs
          ) -> Task:
              """Multi-stage onboarding."""
          
          
          Severity: Minor
          Found in websecmap/scanners/scanner/onboard.py - About 55 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 teams has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def teams(request):
          
              # if you don't have a contest selected, you're required to do so...
              # contest 0 can exist. ?
              if request.session.get("contest", -1) < 0:
          Severity: Minor
          Found in websecmap/game/views.py - About 55 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 parse_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def parse_data(dataset, filename):
              data = read_data(filename)
              # this is some kind of XML format. for which an XSD is available.
              # for each document another namespace version is available, which makes it harder.
              # how can we identify the correct namespace for p correctly automatically?
          Severity: Minor
          Found in websecmap/organizations/datasources/dutch_government.py - About 55 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_identical_sites_on_wildcard_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_identical_sites_on_wildcard_url(wildcard_url: str) -> List[int]:
              identical = []
          
              if not discover_wildcard(wildcard_url):
                  return identical
          Severity: Minor
          Found in websecmap/scanners/scanner/dns_clean_wildcards.py - About 55 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 merge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def merge(
              source_organizations_names: List[str],
              target_organization_name: str,
              when: datetime,
              organization_type: str = "municipality",
          Severity: Minor
          Found in websecmap/organizations/adminstrative_transformations.py - About 55 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 resample has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def resample(feature: Dict, resampling_resolution: float = 0.001):
              # downsample the coordinates using the rdp algorithm, mainly to reduce 50 megabyte to a about 150 kilobytes.
              # The code is a little bit dirty, using these counters. If you can refactor, please do :)
          
              log.info(f"Resampling path for {feature['properties']['name']}")
          Severity: Minor
          Found in websecmap/map/logic/openstreetmap.py - About 55 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 latest_rating_per_day_only has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def latest_rating_per_day_only(scans):
              """
              Update 12 nov 2018: If there are multiple changes per day on the url on the same issue, this might not give the
              correct results yet. For example: DNSSEC was scanned as ERROR and INFO on Nov 5 2018. Both are retrieved. Due to
              some reason, the ERROR one gets in the report, while the last_scan_moment of the INFO one is more recent.
          Severity: Minor
          Found in websecmap/reporting/report.py - About 55 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 rows_to_dataset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def rows_to_dataset(rows, when):
              data = {
                  "metadata": {
                      "type": "toplist",
                      "render_date": timezone.now(),
          Severity: Minor
          Found in websecmap/map/logic/top.py - About 55 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_ticker_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_ticker_data(
              country: str = "NL", organization_type: str = "municipality", weeks_back: int = 0, weeks_duration: int = 0
          ):
          
              weeks_back = int(weeks_back)
          Severity: Minor
          Found in websecmap/map/logic/ticker.py - About 55 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 add_urls_to_organizations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def add_urls_to_organizations(organizations: List[Organization], urls: List[str]) -> None:
              for organization in organizations:
                  for url in urls:
                      # make the API easier to use:
                      # will parse extensive urls: https://www.apple.com:80/yolo/swag
          Severity: Minor
          Found in websecmap/api/apis/zorgkaart.py - About 55 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 add_urls has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def add_urls(organization_id, urls: str):
              # todo: how does it behave with urls with protocol?
          
              # urls is basically garbage input on multiple lines with spaces and comma's and all kinds of unicode.
              # here we try to break up this garbage into small pieces text, some are a url, some are garbage...
          Severity: Minor
          Found in websecmap/map/logic/admin.py - About 55 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 print_progress_bar has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def print_progress_bar(iteration, total, prefix="", suffix="", decimals=1, length=100, fill="█"):
          Severity: Major
          Found in websecmap/app/progressbar.py - About 50 mins to fix
            Severity
            Category
            Status
            Source
            Language