Showing 579 of 869 total issues
Avoid deeply nested control flow statements. Open
Open
if not sibling.selected:
sibling.sibling = True
else:
Function save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def save(self, **kwargs):
from cms.api import add_plugin
new_page = super().save(**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 _set_placeholder_cache_version
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _set_placeholder_cache_version(placeholder, lang, site_id, version, vary_on_list=None, duration=None):
Function find_selected
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def find_selected(nodes):
"""
Finds a selected nav_extender node
"""
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
Consider simplifying this complex logical expression. Open
Open
if (childRestrictions && childRestrictions.length) {
resultElements = resultElements.filter(function() {
var item = $(this);
return (
Consider simplifying this complex logical expression. Open
Open
if (selected.length &&
(e.which == KEY.LEFT || e.which == KEY.RIGHT || e.which == KEY.BACKSPACE || e.which == KEY.DELETE || e.which == KEY.ENTER)) {
var selectedChoice = selected;
if (e.which == KEY.LEFT && prev.length) {
selectedChoice = prev;
Consider simplifying this complex logical expression. Open
Open
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
Consider simplifying this complex logical expression. Open
Open
if language_is_unavailable and not fallback_languages:
# There is no page with the requested language
# and there's no configured fallbacks
return _handle_no_page(request)
elif language_is_unavailable and (redirect_on_fallback or page.is_home):
Function cellRightClickHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
}, cellRightClickHandler = function (tree,node,val,col,t) {
Function cellClickHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
defaultWidth = gs.columnWidth, conf = gs.defaultConf, cellClickHandler = function (tree,node,val,col,t) {
Function _paste_placeholder
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _paste_placeholder(self, request, plugin, target_language,
Function render_plugins
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def render_plugins(self, placeholder, language, context, editable=False, template=None):
Function get_tree_rows
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_tree_rows(self, request, pages, language, depth=1,
Function _get_content
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _get_content(self, context, instance, attribute, language, filters):
Function check_callback
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
check_callback: function(operation, node, node_parent, node_position, more) {
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, dict_, instance, placeholder, processors=None, current_app=None):
Function has_reached_plugin_limit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def has_reached_plugin_limit(placeholder, plugin_type, language, template=None, parent_plugin=None):
Function copy_plugins_to
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def copy_plugins_to(old_plugins, to_placeholder,
Function assign_plugins
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def assign_plugins(request, placeholders, template=None, lang=None, is_fallback=False):
Function _get_page_ids_for_action
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _get_page_ids_for_action(user, site, action, check_global=True, use_cache=True):