divio/django-cms

View on GitHub

Showing 579 of 869 total issues

Function positionDropdown has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        positionDropdown: function() {
            var $dropdown = this.dropdown,
                offset = this.container.offset(),
                height = this.container.outerHeight(false),
                width = this.container.outerWidth(false),
Severity: Major
Found in cms/static/cms/js/select2/select2.js - About 3 hrs to fix

    PlaceholderAdminMixin has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PlaceholderAdminMixin:
    
        def _get_attached_admin(self, placeholder):
            return placeholder._get_attached_admin(admin_site=self.admin_site)
    
    
    Severity: Minor
    Found in cms/admin/placeholderadmin.py - About 3 hrs to fix

      Function _handleResize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          _handleResize() {
              var remainingWidth;
              var availableWidth = this._calculateAvailableWidth();
      
              if (availableWidth > this.items.leftTotalWidth + this.items.rightTotalWidth) {
      Severity: Minor
      Found in cms/static/cms/js/modules/cms.navigation.js - About 3 hrs 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 move_plugin has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def move_plugin(self, request):
              """
              Performs a move or a "paste" operation (when «move_a_copy» is set)
      
              POST request with following parameters:
      Severity: Minor
      Found in cms/admin/placeholderadmin.py - About 3 hrs 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 _setAddPluginModal has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _setAddPluginModal: function _setAddPluginModal(nav) {
              if (nav.hasClass('cms-btn-disabled')) {
                  return false;
              }
              var that = this;
      Severity: Major
      Found in cms/static/cms/js/modules/cms.plugins.js - About 3 hrs to fix

        PageTree has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        var PageTree = new Class({
            options: {
                pasteSelector: '.js-cms-tree-item-paste'
            },
            initialize: function initialize(options) {
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.pagetree.js - About 3 hrs to fix

          Function __init__ has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, *args, **kwargs):
                  super().__init__(*args, **kwargs)
                  self.title_obj = self.instance.get_title_obj(
                      language=self._language,
                      fallback=False,
          Severity: Minor
          Found in cms/admin/forms.py - About 3 hrs 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 render_placeholder has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              def render_placeholder(self, placeholder, context, language=None, page=None,
                                     editable=False, use_cache=False, nodelist=None, width=None):
                  from sekizai.helpers import Watcher
          
                  language = language or self.request_language
          Severity: Minor
          Found in cms/plugin_rendering.py - About 3 hrs 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 _get_attached_field has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              def _get_attached_field(self):
                  from cms.models import CMSPlugin, Page, StaticPlaceholder
                  if not hasattr(self, '_attached_field_cache'):
                      self._attached_field_cache = None
                      relations = self._get_related_objects()
          Severity: Minor
          Found in cms/models/placeholdermodel.py - About 3 hrs 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 assign_plugins has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          def assign_plugins(request, placeholders, template=None, lang=None, is_fallback=False):
              """
              Fetch all plugins for the given ``placeholders`` and
              cast them down to the concrete instances in one query
              per type.
          Severity: Minor
          Found in cms/utils/plugins.py - About 3 hrs 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 manage.py has 302 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #!/usr/bin/env python
          import os
          import sys
          import warnings
          
          
          Severity: Minor
          Found in manage.py - About 3 hrs to fix

            Function create_page has 25 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def create_page(title, template, language, menu_title=None, slug=None,
            Severity: Major
            Found in cms/api.py - About 3 hrs to fix

              Function check_i18n has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              def check_i18n(output):
                  with output.section("Internationalization") as section:
                      if isinstance(getattr(settings, 'CMS_LANGUAGES', {}), dict):
                          section.success("New style CMS_LANGUAGES")
                      else:
              Severity: Minor
              Found in cms/utils/check.py - About 3 hrs 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 copy has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  def copy(self, site, parent_node=None, language=None,
                           translations=True, permissions=False, extensions=True):
                      from cms.utils.page import get_available_slug
              
                      if parent_node:
              Severity: Minor
              Found in cms/models/pagemodel.py - About 3 hrs 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 _get_attached_fields has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _get_attached_fields(self):
                      """
                      Returns an ITERATOR of all non-cmsplugin reverse related fields.
                      """
                      from cms.models import CMSPlugin, UserSettings
              Severity: Minor
              Found in cms/models/placeholdermodel.py - About 2 hrs 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 __new__ has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __new__(cls, name, bases, attrs):
                      super_new = super(CMSPluginBaseMetaclass, cls).__new__
                      parents = [base for base in bases if isinstance(base, CMSPluginBaseMetaclass)]
                      if not parents:
                          # If this is CMSPluginBase itself, and not a subclass, don't do anything
              Severity: Minor
              Found in cms/plugin_base.py - About 2 hrs 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 get_admin_tree_title has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_admin_tree_title(self):
                      from cms.models.titlemodels import EmptyTitle
                      language = get_language()
              
                      if not self.title_cache:
              Severity: Minor
              Found in cms/models/pagemodel.py - About 2 hrs 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 downcast_plugins has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              def downcast_plugins(plugins,
                                   placeholders=None, select_placeholder=False, request=None):
                  plugin_types_map = defaultdict(list)
                  plugin_lookup = {}
                  plugin_ids = []
              Severity: Minor
              Found in cms/utils/plugins.py - About 2 hrs 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 cut_levels has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              def cut_levels(nodes, from_level, to_level, extra_inactive, extra_active):
                  """
                  cutting nodes away from menus
                  """
                  final = []
              Severity: Minor
              Found in menus/templatetags/menu_tags.py - About 2 hrs 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 _edit has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      this._edit = function (obj, col, element) {
                          if(!obj) { return false; }
                          if (element) {
                              element = $(element);
                              if (element.prop("tagName").toLowerCase() === "div") {
              Severity: Major
              Found in cms/static/cms/js/libs/jstree/jstree.grid.min.js - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language