Showing 579 of 869 total issues
Function get_tree_rows
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_tree_rows(self, request, pages, language, depth=1,
follow_descendants=True):
"""
Used for rendering the page tree, inserts into context everything what
we need for single item
- 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 create_page
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create_page(title, template, language, menu_title=None, slug=None,
apphook=None, apphook_namespace=None, redirect=None, meta_description=None,
created_by='python-api', parent=None,
publication_date=None, publication_end_date=None,
in_navigation=False, soft_root=False, reverse_id=None,
- 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_context
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_context(self, context, start_level, template, only_visible):
try:
# If there's an exception (500), default context_processors may not be called.
request = context['request']
except KeyError:
- 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 permissions.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import defaultdict
from contextlib import contextmanager
from functools import lru_cache, wraps
from asgiref.local import Local
Function invalidateState
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
invalidateState(action, data, { propagate = true } = {}) {
// eslint-disable-next-line default-case
switch (action) {
case 'COPY': {
this.handleCopyPlugin(data);
Function _setPluginStructureEvents
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setPluginStructureEvents: function _setPluginStructureEvents() {
var that = this;
// filling up ui object
this.ui.draggable = $('.cms-draggable-' + this.options.plugin_id);
Function movePlugin
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
movePlugin: function(opts) {
// cancel request if already in progress
if (CMS.API.locked) {
return false;
}
Function _loadStructure
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
_loadStructure() {
// case when structure mode is already loaded
if (CMS.config.settings.mode === 'structure' || this._loadedStructure) {
return Promise.resolve();
}
Function setupUI
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupUI: function setupUI(container) {
var wrapper = $(`.${container}`);
var contents;
// have to check for cms-plugin, there can be a case when there are multiple
Function delete_translation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def delete_translation(self, request, object_id, extra_context=None):
if 'delete_language' in request.GET:
language = request.GET['delete_language']
elif 'delete_language' in request.POST:
language = request.POST['delete_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 _build_nodes_inner_for_one_menu
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _build_nodes_inner_for_one_menu(nodes, menu_class_name):
"""
This is an easier to test "inner loop" building the menu tree structure
for one menu (one language, one 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 toggleCollapsable
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
_toggleCollapsable: function toggleCollapsable(el) {
var that = this;
var id = that._getId(el.parent());
var draggable = el.closest('.cms-draggable');
var items;
Function _copyNode
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
_copyNode: function _copyNode(obj) {
var that = this;
var node = { position: 0 };
if (obj) {
Function copyPlugin
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
copyPlugin: function(opts, source_language) {
// cancel request if already in progress
if (CMS.API.locked) {
return false;
}
Function _setupModeSwitcher
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupModeSwitcher() {
const modes = this.ui.toolbarModeLinks;
let cmdPressed;
$(Helpers._getWindow())
Function ajax
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ajax(options) {
var timeout, // current scheduled but not yet executed request
handler = null,
quietMillis = options.quietMillis || 100,
ajaxUrl = options.url,
Function open
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
open(opts) {
// setup internals
if (!((opts && opts.url) || (opts && opts.html))) {
throw new Error('The arguments passed to "open" were invalid.');
}
Function local
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function local(options) {
var data = options, // data elements
dataText,
tmp,
text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
Function _setupSearch
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupSearch: function _setupSearch() {
var that = this;
var click = this.click + '.search';
var filterActive = false;
Function reloadBrowser
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
reloadBrowser: function(url, timeout, ajax, data) {
var that = this;
// is there a parent window?
var win = this._getWindow();
var parent = win.parent ? win.parent : win;
- 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"