divio/django-cms

View on GitHub

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@@

Severity: Major
Found in cms/static/cms/js/select2/select2.js - About 1 wk to fix

    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';
    Severity: Major
    Found in cms/static/cms/js/modules/cms.plugins.js - About 3 days to fix

      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
      Severity: Major
      Found in cms/admin/pageadmin.py - About 3 days to fix

        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
        
        
        Severity: Major
        Found in cms/models/pagemodel.py - About 3 days to fix

          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`
          Severity: Major
          Found in cms/static/cms/js/libs/pep.js - About 2 days to fix

            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';
            Severity: Major
            Found in cms/static/cms/js/modules/cms.structureboard.js - About 2 days to fix

              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 = {
              Severity: Major
              Found in cms/static/cms/js/libs/jstree/jstree.grid.min.js - About 2 days to fix

                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
                Severity: Major
                Found in cms/admin/forms.py - About 2 days to fix

                  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
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py - About 2 days to fix

                    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
                    Severity: Major
                    Found in cms/templatetags/cms_tags.py - About 2 days to fix

                      Page has 93 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Page(models.Model):
                          """
                          A simple hierarchical page model
                          """
                          LIMIT_VISIBILITY_IN_MENU_CHOICES = (
                      Severity: Major
                      Found in cms/models/pagemodel.py - About 1 day to fix

                        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';
                        Severity: Major
                        Found in cms/static/cms/js/modules/cms.modal.js - About 1 day to fix

                          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';
                          Severity: Major
                          Found in cms/static/cms/js/modules/cms.pagetree.js - About 1 day to fix

                            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
                             *
                            Severity: Major
                            Found in cms/static/cms/js/libs/jstree/jstree.grid.min.js - About 1 day to fix

                              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
                              Severity: Major
                              Found in cms/cms_toolbars.py - About 1 day to fix

                                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
                                Severity: Minor
                                Found in cms/utils/placeholder.py - About 1 day to fix

                                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(
                                Severity: Minor
                                Found in cms/cms_toolbars.py - About 1 day to fix

                                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
                                
                                
                                Severity: Major
                                Found in cms/test_utils/testcases.py - About 1 day to fix

                                  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']
                                  Severity: Major
                                  Found in cms/admin/pageadmin.py - About 1 day to fix

                                    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.
                                        """
                                    Severity: Minor
                                    Found in cms/views.py - About 1 day to fix

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language