divio/django-cms

View on GitHub

Showing 579 of 869 total issues

Function populate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def populate(self):
        # always use draft if we have a page
        self.page = get_page_draft(self.request.current_page)

        if not self.page:
Severity: Minor
Found in cms/test_utils/project/extensionapp/cms_toolbars.py - About 1 hr 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_context has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_context(self, context, template, i18n_mode):
        if template in MARKERS:
            _tmp = template
            if i18n_mode not in MARKERS:
                template = i18n_mode
Severity: Minor
Found in menus/templatetags/menu_tags.py - About 1 hr 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_item has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _add_item(self, item, position=None):
        item.toolbar = self

        if item.right:
            if position and position < 0:
Severity: Minor
Found in cms/toolbar/toolbar.py - About 1 hr 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 _verify_apphook has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _verify_apphook(apphook, namespace):
    """
    Verifies the apphook given is valid and returns the normalized form (name)
    """
    apphook_pool.discover_apps()
Severity: Minor
Found in cms/api.py - About 1 hr 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 _moveToDropdown has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _moveToDropdown(numberOfItems, part) {
        if (numberOfItems <= 0) {
            return;
        }

Severity: Minor
Found in cms/static/cms/js/modules/cms.navigation.js - About 1 hr to fix

    Function unselect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            unselect: function (selected) {
                var val = this.getVal(),
                    data,
                    index;
                selected = selected.closest(".select2-search-choice");
    Severity: Minor
    Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

      Function resolveContainerWidth has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function resolveContainerWidth() {
                      var style, attrs, matches, i, l, attr;
      
                      if (this.opts.width === "off") {
                          return null;
      Severity: Minor
      Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

        Function _setupQuickSearch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _setupQuickSearch: function _setupQuickSearch(plugins) {
                var that = this;
                var FILTER_DEBOUNCE_TIMER = 100;
                var FILTER_PICK_DEBOUNCE_TIMER = 110;
        
        
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.plugins.js - About 1 hr to fix

          Function _moveOutOfDropdown has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _moveOutOfDropdown(numberOfItems, part) {
                  if (numberOfItems <= 0) {
                      return;
                  }
          
          
          Severity: Minor
          Found in cms/static/cms/js/modules/cms.navigation.js - About 1 hr to fix

            Function postprocessResults has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    postprocessResults: function (data, initial, noHighlightUpdate) {
                        var val = this.getVal(),
                            choices = this.results.find(".select2-result"),
                            compound = this.results.find(".select2-result-with-children"),
                            self = this;
            Severity: Minor
            Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

              Function prepareOpts has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      prepareOpts: function () {
                          var opts = this.parent.prepareOpts.apply(this, arguments),
                              self=this;
              
                          if (opts.element.get(0).tagName.toLowerCase() === "select") {
              Severity: Minor
              Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

                Function addPlugin has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    addPlugin: function(type, name, parent) {
                        var params = {
                            placeholder_id: this.options.placeholder_id,
                            plugin_type: type,
                            cms_path: path,
                Severity: Minor
                Found in cms/static/cms/js/modules/cms.plugins.js - About 1 hr to fix

                  Function query has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  opts.query = this.bind(function (query) {
                                      var data = { results: [], more: false },
                                          term = query.term,
                                          children, placeholderOption, process;
                  
                  
                  Severity: Minor
                  Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

                    Function _PointerEvent__PointerEvent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function _PointerEvent__PointerEvent(inType, inDict) {
                        inDict = inDict || Object.create(null);
                    
                        var e = document.createEvent('Event');
                        e.initEvent(inType, inDict.bubbles || false, inDict.cancelable || false);
                    Severity: Minor
                    Found in cms/static/cms/js/libs/pep.js - About 1 hr to fix

                      Function _setupKeyboardTraversing has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _setupKeyboardTraversing: function _setupKeyboardTraversing() {
                              var dropdown = $('.cms-modal-markup .cms-plugin-picker');
                              const keyDownTraverseEvent = this._getNamepacedEvent(Plugin.keyDown, 'traverse');
                      
                              if (!dropdown.length) {
                      Severity: Minor
                      Found in cms/static/cms/js/modules/cms.plugins.js - About 1 hr to fix

                        Function _setup has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _setup() {
                                var that = this;
                        
                                // cancel if there is no structure / content switcher
                                if (!this.ui.toolbarModeSwitcher.length) {
                        Severity: Minor
                        Found in cms/static/cms/js/modules/cms.structureboard.js - About 1 hr to fix

                          Function setupNamespaces has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  appHooks.setupNamespaces = function () {
                                      var opt = $(this).find('option:selected');
                          
                                      if ($(appCfgs).length > 0 && apphooks_configuration[opt.val()]) {
                                          appCfgs.html('');
                          Severity: Minor
                          Found in cms/static/cms/js/widgets/forms.apphookselect.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                                        if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) {
                                                            event.stopImmediatePropagation();
                                                        }
                            Severity: Major
                            Found in cms/static/cms/js/libs/jstree/jstree.grid.min.js - About 1 hr to fix

                              Function _get_data_context has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def _get_data_context(self, context, instance, attribute, edit_fields,
                              Severity: Major
                              Found in cms/templatetags/cms_tags.py - About 1 hr to fix

                                Function _get_editable_context has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def _get_editable_context(self, context, instance, language, edit_fields,
                                Severity: Major
                                Found in cms/templatetags/cms_tags.py - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language