divio/django-cms

View on GitHub

Showing 579 of 869 total issues

Function get_publish_button has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_publish_button(self, classes=None):
        dirty = self.has_dirty_objects()
        classes = list(classes or [])

        if dirty and 'cms-btn-publish-active' not in classes:
Severity: Minor
Found in cms/cms_toolbars.py - About 35 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_alphabetical_insert_position has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_alphabetical_insert_position(self, new_menu_name, item_type,
                                         default=0):
        results = self.find_items(item_type)

        # No items yet? Use the default value provided
Severity: Minor
Found in cms/toolbar/items.py - About 35 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 _build_option has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _build_option(self, selected_choices, option_value, option_label):
        if option_value is None:
            option_value = ''
        option_value = force_str(option_value)
        if option_value in selected_choices:
Severity: Minor
Found in cms/forms/widgets.py - About 35 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 app_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def app_path(self):
        if self._app_path is None:
            if settings.USE_I18N:
                page_path = self.get_page_path(get_language_from_request(self.request))
            else:
Severity: Minor
Found in menus/utils.py - About 35 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_or_create_menu has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_or_create_menu(self, key, verbose_name=None, disabled=False, side=LEFT, position=None):
        self.populate()
        if key in self.menus:
            menu = self.menus[key]
            if verbose_name:
Severity: Minor
Found in cms/toolbar/toolbar.py - About 35 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_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_request(self, path=None, language=None, post_data=None, enforce_csrf_checks=False, page=None, domain=None):
        factory = RequestFactory()

        if not path:
            path = self.get_pages_root()
Severity: Minor
Found in cms/test_utils/testcases.py - About 35 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 _has_changed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _has_changed(self, initial, data):
        # THIS IS A COPY OF django.forms.widgets.Widget._has_changed()
        # (except for the first if statement)

        """
Severity: Minor
Found in cms/forms/widgets.py - About 35 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 too many return statements within this function.
Open

                        return;
Severity: Major
Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                            return;
    Severity: Major
    Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                          return;
      Severity: Major
      Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                return;
        Severity: Major
        Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              return this.opts.width();
          Severity: Major
          Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return that.state;
            Severity: Major
            Found in cms/static/cms/js/modules/cms.structureboard.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return;
              Severity: Major
              Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                        return;
                Severity: Major
                Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                          return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
                  Severity: Major
                  Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                            return;
                    Severity: Major
                    Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                          return null;
                      Severity: Major
                      Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                                return;
                        Severity: Major
                        Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                  return;
                          Severity: Major
                          Found in cms/static/cms/js/select2/select2.js - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language