Showing 579 of 869 total issues
Avoid deeply nested control flow statements. Open
if not root_node.selected:
root_node.sibling = True
if node.children:
Function clean_parent_node
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clean_parent_node(self):
# Check to see if this user has permissions to make this page. We've
# already checked this when producing a list of wizard entries, but this
# is to prevent people from possible form-hacking.
if self.page and self.sub_page_form:
- 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_app_urls
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_app_urls(urls):
for urlconf in urls:
if isinstance(urlconf, str):
mod = import_module(urlconf)
if not hasattr(mod, 'urlpatterns'):
- 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 add_sideframe_button
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_sideframe_button(self, name, url, active=False, disabled=False, extra_classes=None, on_close=None):
Function modify
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
Function _set_permissions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _set_permissions(patterns, exclude_permissions):
for pattern in patterns:
if isinstance(pattern, URLResolver):
if pattern.namespace in exclude_permissions:
continue
- 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 add_plugin
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_plugin(placeholder, plugin_type, language, position='last-child',
Function _create_user
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_user(self, username, email, password,
Function modify
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
if breadcrumb:
return nodes
for node in nodes:
- 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 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"
Further reading
Function add_help_menu
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_help_menu(self):
""" Adds the help menu if it's enabled in settings """
if get_cms_setting('ENABLE_HELP'):
self._help_menu = self.toolbar.get_or_create_menu(HELP_MENU_IDENTIFIER, _('Help'), position=-1)
self._help_menu.items = [] # reset the items so we don't duplicate
- 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):
Avoid deeply nested control flow statements. Open
if path == TEMPLATE_INHERITANCE_MAGIC:
templates_menu.add_break(TEMPLATE_MENU_BREAK)
templates_menu.add_ajax_item(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, url, active=False, disabled=False, extra_classes=None, side=LEFT):
Function modify
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, max_length=None, min_length=None, placeholder_text=None,
Function showWarning
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def showWarning(message, category, filename, lineno, file=None, line=None):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, url, active=False, disabled=False, extra_classes=None, on_close=None):
Function add_modal_button
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_modal_button(self, name, url, active=False, disabled=False, extra_classes=None, on_close=REFRESH_PAGE):
Function modify
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):