File plugin_rendering.py
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
import contextlib
from collections import OrderedDict
from functools import partial
from classytags.utils import flatten_context
Function render_placeholder
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def render_placeholder(self, placeholder, context, language=None, page=None,
editable=False, use_cache=False, nodelist=None, width=None):
from sekizai.helpers import Watcher
language = language or self.request_language
- 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 _preload_placeholders_for_page
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _preload_placeholders_for_page(self, page, slots=None, inherit=False):
"""
Populates the internal plugin cache of each placeholder
in the given page if the placeholder has not been
previously cached.
- 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 render_page_placeholder
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def render_page_placeholder(self, slot, context, inherit,
page=None, nodelist=None, editable=True):
if not self.current_page:
# This method should only be used when rendering a cms page.
return ''
- 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 render_placeholder
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_placeholder(self, placeholder, context, language=None, page=None,
Function render_page_placeholder
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_page_placeholder(self, slot, context, inherit,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, placeholder, language, site_id, cached=False,
Function render_plugins
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_plugins(self, placeholder, language, context, editable=False, template=None):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, dict_, instance, placeholder, processors=None, current_app=None):