Showing 579 of 869 total issues
Function set_local_revision
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_local_revision(revision):
if use_threadlocal:
if revision:
_urlconf_revision_threadlocal.value = revision
else:
- 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 is_new_dirty
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_new_dirty(self):
if self.pk:
fields = [
'publication_date', 'publication_end_date', 'in_navigation', 'soft_root', 'reverse_id',
'navigation_extenders', 'template', 'login_required', 'limit_visibility_in_menu'
- 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 admin_reverse
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def admin_reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None,
Function get_available_slug
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_available_slug(site, path, language, suffix='copy', modified=False, current=None):
Function get_view_restrictions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_view_restrictions(pages):
"""
Load all view restrictions for the pages
"""
restricted_pages = defaultdict(list)
- 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)
Avoid deeply nested control flow statements. Open
if extnode.namespace == ext and not extnode.parent_id:
# if home has nav extenders but home is not visible
if node == home and not node.visible:
# extnode.parent_id = None
extnode.parent_namespace = None
Function publish
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def publish(self, language):
"""
:returns: True if page was successfully published.
"""
from cms.utils.permissions import get_current_user_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(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 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):
Avoid deeply nested control flow statements. Open
if str(e) == template:
raise ImproperlyConfigured(
"CMS Plugins must define a render template (%s) that exists: %s"
% (plugin, template)
)
Function save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save(self, no_signals=False, *args, **kwargs):
if not self.depth:
if self.parent_id or self.parent:
self.parent.add_child(instance=self)
else:
- 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 fallback_plugins:
fallbacks[placeholder.pk] += fallback_plugins
break
# These placeholders have no fallback
non_fallback_phs = [ph for ph in placeholders if ph.pk not in fallbacks]
Function copy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def copy(self, target_placeholder, source_language, fieldname, model, target_language, **kwargs):
Function modify
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
Avoid deeply nested control flow statements. Open
if isinstance(node.template.var, Variable):
continue
else:
template = get_template(node.template.var)
else:
Function _create_user
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_user(self, username, email, password,
Function get_request
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_request(self, path=None, language=None, post_data=None, enforce_csrf_checks=False, page=None, domain=None):
Function failUnlessWarns
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def failUnlessWarns(self, category, message, f, *args, **kwargs):
Function failUnlessWarns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def failUnlessWarns(self, category, message, f, *args, **kwargs):
warningsShown = []
cleanwarningsShown = []
result = _collectWarnings(warningsShown.append, f, *args, **kwargs)
- 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"