secureCodeBox/secureCodeBox

View on GitHub
scanners/zap-advanced/scanner/zapclient/scanner/zap_scanner_active.py

Summary

Maintainability
B
4 hrs
Test Coverage

File zap_scanner_active.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0
Severity: Minor
Found in scanners/zap-advanced/scanner/zapclient/scanner/zap_scanner_active.py - About 2 hrs to fix

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

        def __configure_scanner(
            self, zap_scanner: ascan, scanner_config: collections.OrderedDict
        ):
            """Starts a ZAP ActiveScan with the given name for the scanners configuration, based on the given configuration and ZAP instance.
    
    

    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 __start_scanner_with_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def __start_scanner_with_config(
            self, url: str, scanner_config: collections.OrderedDict
        ) -> int:
            """Starts a ZAP ActiveScan with the given name for the scanners configuration, based on the given configuration and ZAP instance.
    
    

    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_alerts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_alerts(self, baseurl, ignore_scan_rules, out_of_scope_dict):
            # Retrieve the alerts using paging in case there are lots of them
            start = 0
            count_per_page = 5000
            alert_dict = {}
    Severity: Minor
    Found in scanners/zap-advanced/scanner/zapclient/scanner/zap_scanner_active.py - About 25 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

    There are no issues that match your filters.

    Category
    Status