divio/django-cms

View on GitHub

Showing 579 of 869 total issues

Function clean has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def clean(self):
        """
        Validates that either the slug is provided, or that slugification from
        `title` produces a valid slug.
        :return:
Severity: Minor
Found in cms/forms/wizards.py - About 55 mins 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, request, request_path=None, _async=False):
        super().__init__()
        self._async = _async
        self.right_items = []
        self.left_items = []
Severity: Minor
Found in cms/toolbar/toolbar.py - About 55 mins 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_empty_context has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _get_empty_context(self, context, instance, edit_fields, language,
Severity: Major
Found in cms/templatetags/cms_tags.py - About 50 mins to fix

    Function copy has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def copy(self, site, parent_node=None, language=None,
    Severity: Major
    Found in cms/models/pagemodel.py - About 50 mins to fix

      Function create_option has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
      Severity: Major
      Found in cms/wizards/forms.py - About 50 mins to fix

        Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, title, weight, form, model=None, template_name=None,
        Severity: Major
        Found in cms/wizards/wizard_base.py - About 50 mins to fix

          Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, name, url, active=False, disabled=False,
          Severity: Major
          Found in cms/toolbar/items.py - About 50 mins to fix

            Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, title, url, id, parent_id=None, parent_namespace=None,
            Severity: Major
            Found in menus/base.py - About 50 mins to fix

              Function add_link_item has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def add_link_item(self, name, url, active=False, disabled=False,
              Severity: Major
              Found in cms/toolbar/items.py - About 50 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (opts.initSelection === undefined) {
                                            opts.initSelection = function (element, callback) {
                                                var data = [];
                                                $(splitVal(element.val(), opts.separator)).each(function () {
                                                    var obj = { id: this, text: this },
                Severity: Major
                Found in cms/static/cms/js/select2/select2.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if (gridCellPrev && gridCellPrev.length > 0) {
                                                  last.insertAfter(gridCellPrev);
                                              } else if (gridCellChild && gridCellChild.length > 0) {
                                                  last.insertBefore(gridCellChild);
                                              } else if (gridCellNext && gridCellNext.length > 0) {
                  Severity: Major
                  Found in cms/static/cms/js/libs/jstree/jstree.grid.min.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            } else if ( ! o.protectRoot) {
                                                this._rearrange(event, item);
                                            }
                    Severity: Major
                    Found in cms/static/cms/js/modules/jquery.ui.nestedsortable.js - About 45 mins to fix

                      Function initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          initialize: function initialize(container, options) {
                              this.options = $.extend(true, {}, this.options, options);
                      
                              // create an unique for this component to use it internally
                              this.uid = uid();
                      Severity: Minor
                      Found in cms/static/cms/js/modules/cms.plugins.js - About 45 mins 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

                      Avoid deeply nested control flow statements.
                      Open

                                              if (equal(opts.id(token), opts.id(selection[i]))) {
                                                  dupe = true; break;
                                              }
                      Severity: Major
                      Found in cms/static/cms/js/select2/select2.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (opts.createSearchChoice === undefined) {
                                                    opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
                                                }
                        Severity: Major
                        Found in cms/static/cms/js/select2/select2.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (this.currentItem[0].parentNode != this.element[0]
                                                             && itemElement.parentNode == this.element[0]
                                                      ) {
                          
                                                          if ( ! $(itemElement).children(o.listType).length) {
                          Severity: Major
                          Found in cms/static/cms/js/modules/jquery.ui.nestedsortable.js - About 45 mins to fix

                            Function open has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                open(opts) {
                                    // setup internals
                                    if (!((opts && opts.url) || (opts && opts.html))) {
                                        throw new Error('The arguments passed to "open" were invalid.');
                                    }
                            Severity: Minor
                            Found in cms/static/cms/js/modules/cms.modal.js - About 45 mins 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 handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def handle(self, *args, **options):
                                    report = plugin_report()
                                    self.stdout.write('==== Plugin report ==== \n\n')
                                    self.stdout.write('There are %s plugin types in your database \n' % len(report))
                                    for plugin in report:
                            Severity: Minor
                            Found in cms/management/commands/subcommands/list.py - About 45 mins 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 is_cms_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def is_cms_request(self, request):
                                    toolbar_hide = get_cms_setting('TOOLBAR_HIDE')
                                    internal_ips = get_cms_setting('INTERNAL_IPS')
                            
                                    if internal_ips:
                            Severity: Minor
                            Found in cms/middleware/toolbar.py - About 45 mins 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 _initialStates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                _initialStates: function _initialStates() {
                                    var publishBtn = $('.cms-btn-publish').parent();
                            
                                    this._show({ duration: 0 });
                            
                            
                            Severity: Minor
                            Found in cms/static/cms/js/modules/cms.toolbar.js - About 45 mins 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