divio/django-cms

View on GitHub

Showing 579 of 869 total issues

Avoid too many return statements within this function.
Open

            return page.get_absolute_url(fallbacks[0], fallback=False)
Severity: Major
Found in menus/utils.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return message % {'page_url': page_url, 'page_title': page_title}
    Severity: Major
    Found in cms/cms_plugins.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return HttpResponse("ok")
      Severity: Major
      Found in cms/cms_plugins.py - About 30 mins to fix

        Function getSettings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            getSettings: function() {
                var settings;
        
        
                // use local storage or session
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.base.js - About 25 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 setColorScheme has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            setColorScheme: function (mode) {
                let body = $('html');
                let scheme = (mode !== 'light' && mode !== 'dark') ? 'auto' : mode;
        
                if (localStorage.getItem('theme') || CMS.config.color_scheme !== scheme) {
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.base.js - About 25 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 _setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            _setup() {
                var that = this;
        
                // cancel if there is no structure / content switcher
                if (!this.ui.toolbarModeSwitcher.length) {
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.structureboard.js - About 25 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 getId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            getId(el) {
                // cancel if no element is defined
                if (el === undefined || el === null || el.length <= 0) {
                    return false;
                }
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.structureboard.js - About 25 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 setSettings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            setSettings: function(newSettings) {
                // merge settings
                var settings = JSON.stringify($.extend({}, window.CMS.config.settings, newSettings));
        
                // use local storage or session
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.base.js - About 25 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 _trackChange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            _trackChange: function _trackChange(e) {
                var that = this;
        
                if (that.state.fields.has(e.target)) {
                    var current = that.state.fields.get(e.target);
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.changetracker.js - About 25 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 onPluginSave has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            onPluginSave: function() {
                var data = this.dataBridge;
                var editedPlugin =
                    data &&
                    data.plugin_id &&
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.base.js - About 25 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 _content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            _content: function _content(url) {
                var that = this;
                var iframe = $('<iframe src="' + url + '" class="" frameborder="0" />');
                var holder = this.ui.frame;
                var contents;
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.sideframe.js - About 25 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 _getOriginalValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            _getOriginalValue: function _getOriginalValue(target) {
                var el = $(target);
        
                if (el.is(':checkbox') || el.is(':radio')) {
                    return target.defaultChecked;
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.changetracker.js - About 25 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 copyPlugin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            copyPlugin: function(opts, source_language) {
                // cancel request if already in progress
                if (CMS.API.locked) {
                    return false;
                }
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.plugins.js - About 25 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_page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def render_page(request, page, current_language, slug):
            """
            Renders a page
            """
            context = {}
        Severity: Minor
        Found in cms/page_rendering.py - About 25 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_context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_context(self, context):
                opts = context['opts']
                change = context['change']
                is_popup = context['is_popup']
                save_as = context['save_as']
        Severity: Minor
        Found in cms/templatetags/cms_admin.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def handle(self, *args, **options):
                try:
                    from_site = int(options.get('from_site', None))
                except Exception:
                    from_site = settings.SITE_ID
        Severity: Minor
        Found in cms/management/commands/subcommands/copy.py - About 25 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_filter_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def render_filter_field(request, field):
            params = request.GET.copy()
        
            if ERROR_FLAG in params:
                del params['ERROR_FLAG']
        Severity: Minor
        Found in cms/templatetags/cms_admin.py - About 25 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_alias_plugin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def render_alias_plugin(context, instance):
            request = context['request']
            toolbar = get_toolbar_from_request(request)
            renderer = toolbar.content_renderer
            source = (instance.plugin or instance.alias_placeholder)
        Severity: Minor
        Found in cms/templatetags/cms_alias_tags.py - About 25 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_add_permission_from_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _has_add_permission_from_request(self, request):
                site = self.get_site(request)
                parent_node_id = request.GET.get('parent_node', None)
        
                if parent_node_id:
        Severity: Minor
        Found in cms/admin/pageadmin.py - About 25 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 register has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def register(self, app=None, discovering_apps=False):
                # allow use as a decorator
                if app is None:
                    return lambda app: self.register(app, discovering_apps)
        
        
        Severity: Minor
        Found in cms/apphook_pool.py - About 25 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