divio/django-cms

View on GitHub

Showing 568 of 991 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 1474 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 1432 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      from collections import namedtuple
      import copy
      import json
      import sys
      Severity: Major
      Found in cms/admin/pageadmin.py - About 3 days to fix

        File pagemodel.py has 1272 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        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

            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 cms.structureboard.js has 1055 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

                File forms.py has 1000 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                from django import forms
                from django.apps import apps
                from django.contrib.auth import get_user_model, get_permission_codename
                from django.contrib.auth.models import Permission
                Severity: Major
                Found in cms/admin/forms.py - About 2 days to fix

                  File placeholderadmin.py has 940 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  import uuid
                  import warnings
                  
                  from django.conf.urls import url
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py - About 2 days to fix

                    File cms_tags.py has 859 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    from collections import namedtuple, OrderedDict
                    from copy import copy
                    from datetime import datetime
                    
                    
                    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 725 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

                              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

                              File cms_toolbars.py has 570 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

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

                                File testcases.py has 548 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                # -*- coding: utf-8 -*-
                                import json
                                import sys
                                import warnings
                                
                                
                                Severity: Major
                                Found in cms/test_utils/testcases.py - About 1 day to fix

                                  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

                                  BasePageAdmin has 60 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

                                    File cms.toolbar.js has 499 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    /*
                                     * Copyright https://github.com/divio/django-cms
                                     */
                                    
                                    import $ from 'jquery';
                                    Severity: Minor
                                    Found in cms/static/cms/js/modules/cms.toolbar.js - About 1 day to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language