Showing 579 of 869 total issues
File cms.base.js
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* CMS.API.Helpers
* Multiple helpers used across all CMS features
*/
import $ from 'jquery';
File managers.py
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
import functools
import operator
from django.contrib.sites.models import Site
from django.db import models
Function _content
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
_content: function _content(url) {
var that = this;
var iframe = $('<iframe src="' + url + '" class="" frameborder="0" />');
var holder = this.ui.frame;
var contents;
Function _delegate
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
_delegate: function _delegate(e) {
e.preventDefault();
e.stopPropagation();
var nav;
Function get_nodes
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def get_nodes(self, request):
from cms.models import Title
site = self.renderer.site
lang = self.renderer.request_language
- 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
File plugins.py
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import defaultdict
from copy import deepcopy
from functools import lru_cache
from itertools import groupby, starmap
from operator import attrgetter, itemgetter
Modal
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Modal {
constructor(options) {
this.options = $.extend(true, {}, Modal.options, options);
// elements
PageToolbar
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class PageToolbar(CMSToolbar):
_changed_admin_menu = None
watch_models = [Page, PageType]
def init_placeholders(self):
Function _loadContent
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
_loadContent() {
var that = this;
// case when content mode is already loaded
if (CMS.config.settings.mode === 'edit' || this._loadedContent) {
Function _get_data_context
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _get_data_context(self, context, instance, attribute, edit_fields,
language, filters, view_url, view_method):
"""
Renders the requested attribute and attach changeform trigger to it
- 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_visible_nodes
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_visible_nodes(request, pages, site):
"""
This code is basically a many-pages-at-once version of
cms.utils.page_permissions.user_can_view_page
pages contains all published pages
- 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_title
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_title(self, page, language, language_fallback=False):
"""
Gets the latest content for a particular page and language. Falls back
to another language if wanted.
"""
- 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 _initialize
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
this._initialize = function () {
if (!this._initialized) {
var s = this.settings.grid || {}, styles, container = this.element, gridparent = container.parent(), i,
gs = this._gridSettings = {
columns : s.columns || [],
Function handleMovePlugin
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleMovePlugin(data) {
if (data.plugin_parent) {
if (data.plugin_id) {
const draggable = $(`.cms-draggable-${data.plugin_id}:last`);
Function get_templates
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_templates():
if getattr(settings, 'CMS_TEMPLATES_DIR', False):
tpldir = getattr(settings, 'CMS_TEMPLATES_DIR', False)
# CMS_TEMPLATES_DIR can either be a string pointing to the templates directory
# or a dictionary holding 'site: template dir' entries
- 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 copy_plugins_to
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def copy_plugins_to(old_plugins, to_placeholder,
to_language=None, parent_plugin_id=None, no_signals=False):
"""
Copies a list of plugins to a placeholder to a language.
"""
- 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_patterns
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _get_app_patterns(site):
"""
Get a list of patterns for all hooked apps.
How this works:
- 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 publish_pages
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def publish_pages(include_unpublished=False, language=None, site=None):
"""
Create published public version of selected drafts.
"""
warnings.warn('This API function will be removed in django CMS 4. For publishing functionality use a package '
- 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 open
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
open: function open(opts) {
if (!(opts && opts.message)) {
throw new Error('The arguments passed to "open" were invalid.');
}
Consider simplifying this complex logical expression. Open
else if (previousItem != null
&& ! previousItem.hasClass(o.disableNestingClass)
&&
(previousItem.children(o.listType).length && previousItem.children(o.listType).is(':visible')
|| ! previousItem.children(o.listType).length)