divio/django-cms

View on GitHub

Showing 579 of 869 total issues

Function get_context has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def get_context(self, context, levels, root_level, nephews, template):
Severity: Minor
Found in menus/templatetags/menu_tags.py - About 35 mins to fix

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

        _delegate: function _delegate(e) {
            e.preventDefault();
            e.stopPropagation();
    
            var nav;
    Severity: Minor
    Found in cms/static/cms/js/modules/cms.plugins.js - 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 show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        show({ init = false, saveState = true } = {}) {
            // cancel show if live modus is active
            if (CMS.config.mode === 'live') {
                return Promise.resolve(false);
            }
    Severity: Minor
    Found in cms/static/cms/js/modules/cms.structureboard.js - 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 invalidateState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        invalidateState(action, data, { propagate = true } = {}) {
            // eslint-disable-next-line default-case
            switch (action) {
                case 'COPY': {
                    this.handleCopyPlugin(data);
    Severity: Minor
    Found in cms/static/cms/js/modules/cms.structureboard.js - 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 _moveOutOfDropdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        _moveOutOfDropdown(numberOfItems, part) {
            if (numberOfItems <= 0) {
                return;
            }
    
    
    Severity: Minor
    Found in cms/static/cms/js/modules/cms.navigation.js - 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_content has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_content(self, context, instance, attribute, language, filters):
            """
            Renders the requested attribute
            """
            extra_context = copy(context)
    Severity: Minor
    Found in cms/templatetags/cms_tags.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 set_home has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_home(self, request, object_id):
            page = self.get_object(request, object_id=object_id)
    
            if not self.has_change_permission(request, page):
                raise PermissionDenied("You do not have permission to set 'home'.")
    Severity: Minor
    Found in cms/admin/pageadmin.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_form_class has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_form_class(self, request, obj=None, **kwargs):
            if 'advanced' in request.path_info:
                return self.advanced_form
            elif 'permission' in request.path_info:
                return PagePermissionForm
    Severity: Minor
    Found in cms/admin/pageadmin.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_toolbar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_toolbar(self, request):
            form = RequestToolbarForm(request.GET or None)
    
            if not form.is_valid():
                return HttpResponseBadRequest('Invalid parameters')
    Severity: Minor
    Found in cms/admin/settingsadmin.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_permissions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_permissions(self, request, page_id):
            rows = []
            user = request.user
            page = self.get_object(request, object_id=page_id)
    
    
    Severity: Minor
    Found in cms/admin/pageadmin.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 handle_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_label(self, label, **options):
            queryset = Page.objects.filter(application_urls=label)
            number_of_apphooks = queryset.count()
    
            if number_of_apphooks > 0:
    Severity: Minor
    Found in cms/management/commands/subcommands/uninstall.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 unpublish has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def unpublish(self, request, page_id, language):
            """
            Publish or unpublish a language of a page
            """
            page = self.get_object(request, object_id=page_id)
    Severity: Minor
    Found in cms/admin/pageadmin.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_apphook has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_apphook(self, app_name):
            if not self.discovered:
                self.discover_apps()
    
            try:
    Severity: Minor
    Found in cms/apphook_pool.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 _copyNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        _copyNode: function _copyNode(obj) {
            var that = this;
            var node = { position: 0 };
    
            if (obj) {
    Severity: Minor
    Found in cms/static/cms/js/modules/cms.pagetree.js - 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 clear_placeholder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def clear_placeholder(self, request, placeholder_id):
            placeholder = get_object_or_404(Placeholder, pk=placeholder_id)
            language = request.GET.get('language')
    
            if placeholder.pk == request.toolbar.clipboard.pk:
    Severity: Minor
    Found in cms/admin/placeholderadmin.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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def save(self, *args, **kwargs):
            source = self.cleaned_data.get('source')
            parent = self.cleaned_data.get('parent_node')
    
            if source:
    Severity: Minor
    Found in cms/admin/forms.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 clean has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def clean(self):
            data = self.cleaned_data
    
            if self._errors:
                # Form already has errors, best to let those be
    Severity: Minor
    Found in cms/admin/forms.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 _show_placeholder_by_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def _show_placeholder_by_id(context, placeholder_name, reverse_id,
                                lang=None, site=None, use_cache=True):
        validate_placeholder_name(placeholder_name)
    
        request = context['request']
    Severity: Minor
    Found in cms/templatetags/cms_tags.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 copy_page has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def copy_page(self, request, page_id):
            """
            Copy the page and all its plugins and descendants to the requested
            target, at the given position
            """
    Severity: Minor
    Found in cms/admin/pageadmin.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 bind has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        Function.prototype.bind = function(oThis) {
            if (typeof this !== 'function') {
                // closest thing possible to the ECMAScript 5
                // internal IsCallable function
                throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
    Severity: Minor
    Found in cms/static/cms/js/polyfills/function.prototype.bind.js - 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

    Severity
    Category
    Status
    Source
    Language