divio/django-cms

View on GitHub

Showing 579 of 869 total issues

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

    def render_placeholder(self, placeholder, context, language=None, page=None,
Severity: Major
Found in cms/plugin_rendering.py - About 1 hr to fix

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

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

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

          def add_button(self, name, url, active=False, disabled=False, extra_classes=None, extra_wrapper_classes=None,
      Severity: Major
      Found in cms/toolbar/toolbar.py - About 1 hr to fix

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

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

          Function create_option has 8 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/forms/widgets.py - About 1 hr to fix

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

                _checkIfPasteAllowed: function _checkIfPasteAllowed() {
                    var pasteButton = this.ui.dropdown.find('[data-rel=paste]');
                    var pasteItem = pasteButton.parent();
            
                    if (!clipboardDraggable.length) {
            Severity: Minor
            Found in cms/static/cms/js/modules/cms.plugins.js - 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 findIndex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                Array.prototype.findIndex = function (predicate) {
                    if (this === null) {
                        throw new TypeError('Array.prototype.findIndex called on null or undefined');
                    }
                    if (typeof predicate !== 'function') {
            Severity: Minor
            Found in cms/static/cms/js/polyfills/array.prototype.findindex.js - 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 edit_field has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def edit_field(self, request, object_id, language):
                    obj = self._get_object_for_single_field(object_id, language)
                    opts = obj.__class__._meta
                    saved_successfully = False
                    cancel_clicked = request.POST.get("_cancel", False)
            Severity: Minor
            Found in cms/admin/placeholderadmin.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 preview_page has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def preview_page(self, request, object_id, language):
                    """
                    Redirecting preview function based on draft_id
                    """
                    page = self.get_object(request, object_id=object_id)
            Severity: Minor
            Found in cms/admin/pageadmin.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 _calculateNewPosition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                _calculateNewPosition(opts) {
                    // lets set the modal width and height to the size of the browser
                    var widthOffset = 300; // adds margin left and right
                    var heightOffset = 300; // adds margin top and bottom;
                    var screenWidth = this.ui.window.width();
            Severity: Minor
            Found in cms/static/cms/js/modules/cms.modal.js - 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def _get_empty_context(self, context, instance, edit_fields, language,
                                       view_url, view_method, editmode=True):
                    """
                    Inject in a copy of the context the data requested to trigger the edit.
            
            
            Severity: Minor
            Found in cms/templatetags/cms_tags.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 render_tag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def render_tag(self, context, code, extra_bits, nodelist=None):
                    request = context.get('request')
            
                    if not code or not request:
                        # an empty string was passed in or the variable is not available in the context
            Severity: Minor
            Found in cms/templatetags/cms_tags.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 delete_view has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def delete_view(self, request, object_id, extra_context=None):
                    # This is an unfortunate copy/paste from django's delete view.
                    # The reason is to add the descendant pages to the deleted objects list.
                    opts = self.model._meta
                    app_label = opts.app_label
            Severity: Minor
            Found in cms/admin/pageadmin.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 clean has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def clean(self):
                    super().clean()
            
                    if not self.user and not self.group:
                        raise ValidationError(_('Please select user or group.'))
            Severity: Minor
            Found in cms/models/permissionmodels.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 user_can_view_page has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def user_can_view_page(user, page, site=None):
                if site is None:
                    site = get_current_site()
            
                if user.is_superuser:
            Severity: Minor
            Found in cms/utils/page_permissions.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 clean has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def clean(self):
                    from cms.utils.plugins import has_reached_plugin_limit
            
                    data = self.cleaned_data
            
            
            Severity: Minor
            Found in cms/admin/forms.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 _copy_title_extensions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def _copy_title_extensions(self, source_page, target_page, language, clone=False):
                    source_title = source_page.title_set.get(language=language)
                    if target_page:
                        target_title = target_page.title_set.get(language=language)
                    else:
            Severity: Minor
            Found in cms/extensions/extension_pool.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 auth_permission_required has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def auth_permission_required(action):
                def decorator(func):
                    @wraps(func, assigned=available_attrs(func))
                    def wrapper(user, *args, **kwargs):
                        if not user.is_authenticated:
            Severity: Minor
            Found in cms/utils/page_permissions.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 _build_nodes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def _build_nodes(self):
                    """
                    This is slow. Caching must be used.
                    One menu is built per language and per site.
            
            
            Severity: Minor
            Found in menus/menu_pool.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 add_draft_live has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def add_draft_live(self):
                    if self.page:
                        if self.toolbar.edit_mode_active and not self.title:
                            self.add_page_settings_button()
            
            
            Severity: Minor
            Found in cms/cms_toolbars.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

            Severity
            Category
            Status
            Source
            Language