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
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.
- Read upRead up
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.
- Read upRead up
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 = {}
- Read upRead up
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"