Showing 579 of 869 total issues
Function refreshPlugins
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Plugin._refreshPlugins = function refreshPlugins() {
Plugin.aliasPluginDuplicatesMap = {};
Plugin.staticPlaceholderDuplicatesMap = {};
CMS._plugins = uniqWith(CMS._plugins, isEqual);
Function destroy
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
destroy: function () {
var element=this.opts.element, select2 = element.data("select2"), self = this;
this.close();
Function cutPlugin
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
cutPlugin: function() {
// if cut is once triggered, prevent additional actions
if (CMS.API.locked) {
return false;
}
Function addJsScriptsNeededForRender
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
addJsScriptsNeededForRender(newScripts, oldScripts) {
const scriptSrcList = [];
let classListCollection = [];
const that = this;
Function _setPluginContentEvents
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setPluginContentEvents: function _setPluginContentEvents() {
const pluginDoubleClickEvent = this._getNamepacedEvent(Plugin.doubleClick);
this.ui.container
.off('mouseover.cms.plugins')
Function add_ajax_item
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_ajax_item(self, name, action, active=False, disabled=False,
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, action, csrf_token, data=None, active=False,
Function create_title
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_title(language, title, page, menu_title=None, slug=None,
Function _filterPluginsList
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_filterPluginsList: function _filterPluginsList(list, input) {
var items = list.find('.cms-submenu-item');
var titles = list.find('.cms-submenu-item-title');
var query = input.val();
Function _paste
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_paste: function _paste(event) {
// hide helpers after we picked one
this._disablePaste();
var copyFromId = this._getNodeId(
Function bindPlaceholderKeys
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var bindPlaceholderKeys = function () {
keyboard.setContext('placeholders');
keyboard.bind('escape', function () {
$('.cms-structure .cms-dragarea').removeAttr('tabindex');
$('.cms-structure-content').untrap();
Consider simplifying this complex logical expression. Open
if (parentItem != null
&& nextItem == null
&& ! (o.protectRoot && parentItem[0].parentNode == this.element[0])
&&
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth())
Function initContainerWidth
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
initContainerWidth: function () {
function resolveContainerWidth() {
var style, attrs, matches, i, l, attr;
if (this.opts.width === "off") {
Function loadMoreIfNeeded
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadMoreIfNeeded: function () {
var results = this.results,
more = results.find("li.select2-more-results"),
below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
page = this.resultsPage + 1,
Function _setAjaxPost
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setAjaxPost: function _setAjaxPost(trigger) {
var that = this;
this.ui.container.on(this.click, trigger, function(e) {
e.preventDefault();
Function onSelect
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSelect: function (data, options) {
if (!this.triggerSelect(data) || data.text === "") { return; }
this.addSelectedChoice(data);
Function getFocusableElementsInContainer
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getFocusableElementsInContainer(container) {
var $container = $(container);
var result = [],
cnt = 0;
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 __init__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
user = get_current_user() # current user from threadlocals
site = Site.objects.get_current()
sub_users = get_subordinate_users(user, site)
- 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"