Showing 579 of 869 total issues
Function _show_placeholder_by_id
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _show_placeholder_by_id(context, placeholder_name, reverse_id,
Function _move_plugin
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _move_plugin(self, request, plugin, target_language,
Function is_cms_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_cms_request(self, request):
toolbar_hide = get_cms_setting('TOOLBAR_HIDE')
internal_ips = get_cms_setting('INTERNAL_IPS')
if internal_ips:
- 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_descendants_tree
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _update_descendants_tree(self, root):
nodes = TreeNode.objects.all()
descendants_by_parent = OrderedDict()
for descendant in get_descendants(root):
- 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 _paste_plugin
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _paste_plugin(self, request, plugin, target_language,
Function render_page_placeholder
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_page_placeholder(self, slot, context, inherit,
Function render_change_form
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
Function save_permissions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save_permissions(data, obj):
models = (
(Page, 'page'),
(PageUser, 'pageuser'),
(PageUserGroup, 'pageuser'),
- 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_context
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_context(self, context, instance, language, view_url, view_method,
Function handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
report = plugin_report()
self.stdout.write('==== Plugin report ==== \n\n')
self.stdout.write('There are %s plugin types in your database \n' % len(report))
for plugin in report:
- 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_cms_structure_js
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def render_cms_structure_js(context, renderer, obj):
markup_bits = []
static_placeholders = []
page_placeholders_by_slot = obj.rescan_placeholders()
declared_static_placeholders = obj.get_declared_static_placeholders(context)
- 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_fieldsets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_fieldsets(self, request, obj=None):
"""
Nobody can grant more than he haves, so check for user permissions
to Page and User model and render fieldset depending on them.
"""
- 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 self._check_unique_namespace_instance(application_namespace):
# Looks like there's already one with the default instance
# namespace defined.
self._errors['application_namespace'] = ErrorList([
_('An application instance with this name already exists.')
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, url, data=None, question=None, action='ajax', attributes=None):
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"
Further reading
Function move_to_mp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def move_to_mp(apps, schema_editor):
db_alias = schema_editor.connection.alias
Page = apps.get_model("cms", "Page")
CMSPlugin = apps.get_model("cms", "CMSPlugin")
- 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
for lang in items:
if lang['code'].find('_') > -1:
section.warn("CMS_LANGUAGES entries must contain valid language codes, not locales (e.g.: "
"'en-us' instead of 'en_US'): '%s' provided" % lang['code'])
else:
Function clean
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
data = self.cleaned_data
obj_id = data.get('obj_id')
obj_type = data.get('obj_type')
- 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 modify
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
Function send_mail
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_mail(subject, txt_template, to, context=None, html_template=None, fail_silently=True):