divio/django-cms

View on GitHub

Showing 579 of 869 total issues

Avoid deeply nested control flow statements.
Open

                        if not root_node.selected:
                            root_node.sibling = True
                if node.children:
Severity: Major
Found in menus/modifiers.py - About 45 mins to fix

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

        def clean_parent_node(self):
            # Check to see if this user has permissions to make this page. We've
            # already checked this when producing a list of wizard entries, but this
            # is to prevent people from possible form-hacking.
            if self.page and self.sub_page_form:
    Severity: Minor
    Found in cms/forms/wizards.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 get_app_urls has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_app_urls(urls):
        for urlconf in urls:
            if isinstance(urlconf, str):
                mod = import_module(urlconf)
                if not hasattr(mod, 'urlpatterns'):
    Severity: Minor
    Found in cms/appresolver.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 add_sideframe_button has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add_sideframe_button(self, name, url, active=False, disabled=False, extra_classes=None, on_close=None):
    Severity: Minor
    Found in cms/toolbar/items.py - About 45 mins to fix

      Function modify has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
      Severity: Minor
      Found in menus/base.py - About 45 mins to fix

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

        def _set_permissions(patterns, exclude_permissions):
            for pattern in patterns:
                if isinstance(pattern, URLResolver):
                    if pattern.namespace in exclude_permissions:
                        continue
        Severity: Minor
        Found in cms/appresolver.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 add_plugin has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def add_plugin(placeholder, plugin_type, language, position='last-child',
        Severity: Minor
        Found in cms/api.py - About 45 mins to fix

          Function _create_user has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _create_user(self, username, email, password,
          Severity: Minor
          Found in cms/test_utils/project/customuserapp/models.py - About 45 mins to fix

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

                def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
                    if breadcrumb:
                        return nodes
                    for node in nodes:
            
            
            Severity: Minor
            Found in menus/modifiers.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 failUnlessWarns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def failUnlessWarns(self, category, message, f, *args, **kwargs):
                    warningsShown = []
                    cleanwarningsShown = []
                    result = _collectWarnings(warningsShown.append, f, *args, **kwargs)
            
            
            Severity: Minor
            Found in cms/test_utils/testcases.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 add_help_menu has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def add_help_menu(self):
                    """ Adds the help menu if it's enabled in settings """
                    if get_cms_setting('ENABLE_HELP'):
                        self._help_menu = self.toolbar.get_or_create_menu(HELP_MENU_IDENTIFIER, _('Help'), position=-1)
                        self._help_menu.items = []  # reset the items so we don't duplicate
            Severity: Minor
            Found in cms/cms_toolbars.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 modify has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
            Severity: Minor
            Found in menus/modifiers.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if path == TEMPLATE_INHERITANCE_MAGIC:
                                          templates_menu.add_break(TEMPLATE_MENU_BREAK)
                                      templates_menu.add_ajax_item(
              Severity: Major
              Found in cms/cms_toolbars.py - About 45 mins to fix

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

                    def __init__(self, name, url, active=False, disabled=False, extra_classes=None, side=LEFT):
                Severity: Minor
                Found in cms/toolbar/items.py - About 45 mins to fix

                  Function modify has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
                  Severity: Minor
                  Found in menus/modifiers.py - About 45 mins to fix

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

                        def __init__(self, max_length=None, min_length=None, placeholder_text=None,
                    Severity: Minor
                    Found in cms/forms/fields.py - About 45 mins to fix

                      Function showWarning has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def showWarning(message, category, filename, lineno, file=None, line=None):
                      Severity: Minor
                      Found in cms/test_utils/testcases.py - About 45 mins to fix

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

                            def __init__(self, name, url, active=False, disabled=False,  extra_classes=None, on_close=None):
                        Severity: Minor
                        Found in cms/toolbar/items.py - About 45 mins to fix

                          Function add_modal_button has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def add_modal_button(self, name, url, active=False, disabled=False, extra_classes=None, on_close=REFRESH_PAGE):
                          Severity: Minor
                          Found in cms/toolbar/items.py - About 45 mins to fix

                            Function modify has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
                            Severity: Minor
                            Found in menus/modifiers.py - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language