failmap/admin

View on GitHub

Showing 267 of 577 total issues

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

def explain(scan_id: int, scan_type: str, explanation: str, explained_by: str, days: int = 365) -> Dict[str, Any]:
Severity: Minor
Found in websecmap/map/logic/explain.py - About 35 mins to fix

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

    def ticker(
    Severity: Minor
    Found in websecmap/map/views.py - About 35 mins to fix

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

      def organization_report_by_name(
      Severity: Minor
      Found in websecmap/map/views.py - About 35 mins to fix

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

        def improvements(
        Severity: Minor
        Found in websecmap/map/views.py - About 35 mins to fix

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

          def organization_report_by_id(
          Severity: Minor
          Found in websecmap/map/views.py - About 35 mins to fix

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

            def inquire_organization():
                """
                Get one or more organizations to add urls to.
                :return:
                """
            Severity: Minor
            Found in websecmap/organizations/management/commands/add_urls.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 askreset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def askreset():
            
                # The dev dataset should not mean anything.
                if settings.DEBUG:
                    and_its_gone()
            Severity: Minor
            Found in websecmap/organizations/management/commands/clear_database.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 check_valid_urls has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def check_valid_urls(urls):
                valid = []
            
                for url in urls:
                    url = url.lower()
            Severity: Minor
            Found in websecmap/game/admin.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_or_create_module_models has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_or_create_module_models(self, user):
                    module_models = []
            
                    i = 0
            
            
            Severity: Minor
            Found in websecmap/app/dashboard.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 compose has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def compose(self, *args, **options):
                    scanners = [
                        dnssec,
                        ftp,
                        http,
            Severity: Minor
            Found in websecmap/scanners/management/commands/plan_consume.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 qualys_scan_bulk has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def qualys_scan_bulk(proxy: Dict[str, Any], urls: List[str]):
            
                log.debug("Initiating bulk scan")
                log.debug("Received proxy: %s" % proxy)
                log.debug("Received urls: %s" % urls)
            Severity: Minor
            Found in websecmap/scanners/scanner/tls_qualys.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 filter_websites has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def filter_websites(sites):
                    incomplete = []
                    not_resolvable = []
                    valid = []
            
            
            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 get_impact has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_impact(severity):
                if severity["is_explained"]:
                    return "good"
                return "high" if severity["high"] else "medium" if severity["medium"] else "low" if severity["low"] else "good"
            
            
            Severity: Minor
            Found in websecmap/scanners/impact.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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def store(result: dict, endpoint_id: int):
                """
            
                :param result: param endpoint:
                :param endpoint:
            Severity: Minor
            Found in websecmap/scanners/scanner/ftp.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 list_outdated has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def list_outdated(published_scan_types):
                for map_configuration in filter_map_configs():
                    print(f"Outdated items for {map_configuration['country']}/{map_configuration['organization_type__name']}:")
                    organizations_on_map = Organization.objects.all().filter(
                        country=map_configuration["country"], type=map_configuration["organization_type"]
            Severity: Minor
            Found in websecmap/scanners/plannedscan.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_cert_chain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_cert_chain(url, port, ip_version) -> List[OpenSSL.crypto.X509]:
                # https://stackoverflow.com/questions/19145097/getting-certificate-chain-with-python-3-3-ssl-module
                # Relatively new Dutch governmental sites relying on anything less < TLS 1.2 is insane.
                log.debug(f"Retrieving certificate chain from {url}:{port}.")
                try:
            Severity: Minor
            Found in websecmap/scanners/scanner/autoexplain_dutch_untrusted_cert.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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def store(results, endpoint_id):
            
                resolves, can_connect_result, redirects_to_safety_result = results
            
                if not resolves:
            Severity: Minor
            Found in websecmap/scanners/scanner/plain_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 valid_api_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def valid_api_settings(scan: InternetNLV2Scan):
                if not config.INTERNET_NL_API_USERNAME:
                    update_state(
                        scan.pk,
                        "configuration_error",
            Severity: Minor
            Found in websecmap/scanners/scanner/internet_nl_v2_websecmap.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 redirects_to_safety has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def redirects_to_safety(url: str):
                """
                Also includes the ip-version of the endpoint. Implies that the endpoint resolves.
                Any safety over any network is accepted now, both A and AAAA records.
            
            
            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 scan_tasks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def scan_tasks(url_chunk):
                tasks = []
            
                for scanner in DEFAULT_SCANNERS:
                    # Tls qualys scans are inserted per 25. This is due to behaviour of the qualys service.
            Severity: Minor
            Found in websecmap/scanners/tasks.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

            Severity
            Category
            Status
            Source
            Language