Showing 579 of 869 total issues
File plugin_rendering.py
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
import contextlib
from collections import OrderedDict
from functools import partial
from classytags.utils import flatten_context
File cms.toolbar.js
has 493 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright https://github.com/divio/django-cms
*/
import $ from 'jquery';
Function _events
has 194 lines of code (exceeds 25 allowed). Consider refactoring. Open
_events: function _events() {
var that = this;
var LONG_MENUS_THROTTLE = 10;
// attach event to the navigation elements
Function _mouseDrag
has 189 lines of code (exceeds 25 allowed). Consider refactoring. Open
_mouseDrag: function(event) {
var i, item, itemElement, intersection,
o = this.options,
scrolled = false;
Function modify
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
if post_cut or breadcrumb:
return nodes
selected = None
root_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
BaseCMSTestCase
has 51 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseCMSTestCase:
counter = 1
def _fixture_setup(self):
super()._fixture_setup()
Function publish_page
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def publish_page(self, request, page_id, language):
page = self.get_object(request, object_id=page_id)
if page and not self.has_publish_permission(request, obj=page):
return HttpResponseForbidden(force_str(_("You do not have permission to publish this page")))
- 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 a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
if post_cut:
return nodes
# rearrange the parent relations
# Find home
- 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 placeholdermodel.py
has 460 lines of code (exceeds 250 allowed). Consider refactoring. Open
import warnings
from datetime import datetime, timedelta
from django.contrib import admin
from django.db import models
Function clean
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
cleaned_data = super().clean()
if cleaned_data.get("overwrite_url"):
# Assuming that the user enters a full URL in the overwrite_url input.
# Here we validate it before publishing the page and if it contains
- 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 handle
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
verbose = options.get('verbosity') > 1
only_empty = options.get('only_empty')
copy_content = options.get('copy_content')
from_lang = options.get('from_lang')
- 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 _ensure_languages_settings
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def _ensure_languages_settings(languages):
valid_language_keys = ['code', 'name', 'fallbacks', 'hide_untranslated', 'redirect_on_fallback', 'public']
required_language_keys = ['code', 'name']
simple_defaults = ['public', 'redirect_on_fallback', 'hide_untranslated']
- 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 jquery.ui.nestedsortable.js
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* jQuery UI Nested Sortable
* v 2.0 / 29 oct 2012
* http://mjsarfatti.com/sandbox/nestedSortable
*
File items.py
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
from abc import ABCMeta
from collections import defaultdict
from django.template.loader import render_to_string
Function _loadIframe
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
_loadIframe(opts) {
var that = this;
const SHOW_LOADER_TIMEOUT = 500;
opts.url = Helpers.makeURL(opts.url);
StructureBoard
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
class StructureBoard {
constructor() {
// elements
this._setupUI();
File api.py
has 430 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Public Python API to create CMS contents.
WARNING: None of the functions defined in this module checks for permissions.
You must implement the necessary permission checks in your own code before
Function _events
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
_events: function _events() {
var that = this;
// set events for the nodeId updates
this.ui.tree.on('after_close.jstree', function(e, el) {
Function resolve
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def resolve(self, request):
if not request.user.is_staff:
return HttpResponse('/', content_type='text/plain')
obj = False
url = False
- 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 pluginmodel.py
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
import inspect
import json
import os
import warnings
from datetime import date