Function _update_list_setting
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def _update_list_setting(original_setting: List, configuration: Iterable):
for config_value in configuration:
# configuration items can be either strings (which are appended) or dictionaries which contains information
# about the position of the item
if isinstance(config_value, 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"
Further reading
Function update_setting
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def update_setting(project_setting: str, config: Dict[str, Any]):
"""
Patch the settings module to include addon settings.
Original file is overwritten. As file is patched using AST, original comments and file structure is lost.
- 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 update_urlconf
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def update_urlconf(project_urls: str, config: Dict[str, Any]):
"""
Patch the ``ROOT_URLCONF`` module to include addon url patterns.
Original file is overwritten. As file is patched using AST, original comments and file structure is lost.
- 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 deeply nested control flow statements. Open
if ast_position is None:
node.value.keys.append(_ast_get_object_from_value(dict_key))
node.value.values.append(_ast_get_object_from_value(dict_value))
else:
node.value.values[ast_position] = _ast_get_object_from_value(dict_value)