File zap_context.py
has 341 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_context
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _configure_context(self, context: collections.OrderedDict):
"""Configures the ZAP instance with the context.
Parameters
----------
- 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
Avoid too many return
statements within this function. Open
return 3
Avoid too many return
statements within this function. Open
return None
Function configure_contexts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configure_contexts(self):
"""Configures the ZAP instance with the given list of contexts."""
if self.get_config.has_configurations:
- 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 _configure_alert_filters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _configure_alert_filters(
self, alert_filters: List[collections.OrderedDict], context_id: int
):
"""Protected method to configure the ZAP 'Context / Alert Filters' Settings based on a given ZAP config.
- 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 _configure_context_session_management
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _configure_context_session_management(
self, sessions_config: collections.OrderedDict, context_id: int
):
"""Protected method to configure the ZAP 'Context / Session Mannagement' Settings based on a given ZAP config.
- 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"