Function _scan_placeholders
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
def _scan_placeholders(nodelist, node_class=None, current_block=None, ignore_blocks=None):
from cms.templatetags.cms_tags import Placeholder
if not node_class:
node_class = Placeholder
- 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_placeholder_conf
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def get_placeholder_conf(setting, placeholder, template=None, default=None):
"""
Returns the placeholder configuration for a given setting. The key would for
example be 'plugins' or 'name'.
- 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 isinstance(node, BlockNode):
current_block = node
nodes += _scan_placeholders(obj, node_class, current_block, ignore_blocks)
Function copy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def copy(self, target_placeholder, source_language, fieldname, model, target_language, **kwargs):
Avoid deeply nested control flow statements. Open
if isinstance(node.template.var, Variable):
continue
else:
template = get_template(node.template.var)
else:
Avoid deeply nested control flow statements. Open
if isinstance(subnodelist, NodeList):
if isinstance(node, BlockNode):
current_block = node
nodes += _scan_placeholders(subnodelist, node_class, current_block, ignore_blocks)
# else just scan the node for nodelist instance attributes
Function _get_block_nodes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_block_nodes(extend_node, previous_context=None):
if not previous_context:
previous_context = get_context(extend_node)
parent = extend_node.get_parent(previous_context)
parent_nodelist = _get_nodelist(parent)
- 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"