Showing 579 of 869 total issues
File select2.js
has 2562 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright 2012 Igor Vaynberg
Version: @@ver@@ Timestamp: @@timestamp@@
File cms.plugins.js
has 1473 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright https://github.com/divio/django-cms
*/
import Modal from './cms.modal';
import StructureBoard from './cms.structureboard';
File pageadmin.py
has 1416 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import re
import sys
import uuid
from collections import namedtuple
File pagemodel.py
has 1273 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
from collections import OrderedDict
from logging import getLogger
from os.path import join
File pep.js
has 1106 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* PEP v0.3.0 | https://github.com/jquery/PEP
* Copyright jQuery Foundation and other contributors | http://jquery.org/license
*
* This file is modified for CMS. All `touch-action` attributes are now `data-touch-action`
File cms.structureboard.js
has 1105 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright https://github.com/divio/django-cms
*/
import $ from 'jquery';
Function grid
has 553 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.jstree.plugins.grid = function(options,parent) {
this._initialize = function () {
if (!this._initialized) {
var s = this.settings.grid || {}, styles, container = this.element, gridparent = container.parent(), i,
gs = this._gridSettings = {
File forms.py
has 1050 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django import forms
from django.apps import apps
from django.contrib.auth import get_permission_codename, get_user_model
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
File placeholderadmin.py
has 933 lines of code (exceeds 250 allowed). Consider refactoring. Open
import uuid
import warnings
from urllib.parse import parse_qsl, urlparse
from django.contrib.admin.helpers import AdminForm
File cms_tags.py
has 851 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import OrderedDict, namedtuple
from copy import copy
from datetime import datetime
from classytags.arguments import Argument, MultiKeywordArgument, MultiValueArgument
Page
has 93 functions (exceeds 20 allowed). Consider refactoring. Open
class Page(models.Model):
"""
A simple hierarchical page model
"""
LIMIT_VISIBILITY_IN_MENU_CHOICES = (
File cms.modal.js
has 743 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright https://github.com/divio/django-cms
*/
import ChangeTracker from './cms.changetracker';
File cms.pagetree.js
has 743 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright https://github.com/divio/django-cms
*/
import $ from 'jquery';
File jstree.grid.min.js
has 626 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* https://github.com/deitch/jstree-grid
*
* This plugin handles adding a grid to a tree to display additional data
*
File cms_toolbars.py
has 626 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_permission_codename, get_user_model
from django.contrib.auth.models import AnonymousUser
from django.contrib.sites.models import Site
Function _scan_placeholders
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
def _scan_placeholders(nodelist, node_class=None, current_block=None, ignore_blocks=None):
from cms.templatetags.cms_tags import Placeholder
if not node_class:
node_class = Placeholder
- 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 add_page_menu
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def add_page_menu(self):
if self.page:
edit_mode = self.toolbar.edit_mode_active
refresh = self.toolbar.REFRESH_PAGE
can_change = user_can_change_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
File testcases.py
has 543 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import sys
import warnings
from urllib.parse import unquote, urljoin
BasePageAdmin
has 59 functions (exceeds 20 allowed). Consider refactoring. Open
class BasePageAdmin(PlaceholderAdminMixin, admin.ModelAdmin):
form = AddPageForm
ordering = ('node__path',)
search_fields = ('=id', 'title_set__slug', 'title_set__title', 'reverse_id')
add_general_fields = ['title', 'slug', 'language', 'template']
Function details
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def details(request, slug):
"""
The main view of the Django-CMS! Takes a request and a slug, renders the
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"