divio/django-cms

View on GitHub

Showing 579 of 869 total issues

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

    def add_modal_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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, queryset=None, empty_label="---------", cache_choices=False,
    Severity: Major
    Found in cms/forms/fields.py - About 1 hr to fix

      Function add_sideframe_button has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def add_sideframe_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 get_context has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_context(self, context, from_level, to_level, extra_inactive,
        Severity: Major
        Found in menus/templatetags/menu_tags.py - About 1 hr to fix

          Function addSlugHandlers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function addSlugHandlers(title, slug) {
              if (!slug.length) {
                  return;
              }
          
          
          Severity: Minor
          Found in cms/static/cms/js/modules/slug.js - About 1 hr to fix

            Function initSelection has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            opts.initSelection = opts.initSelection || function (element, callback) {
                                var ids = splitVal(element.val(), opts.separator);
                                //search in data by array of ids, storing matching items in a list
                                var matches = [];
                                opts.query({
            Severity: Minor
            Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

              Function _updateWithMostUsedPlugins has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _updateWithMostUsedPlugins: function _updateWithMostUsedPlugins(plugins) {
                      const items = plugins.find('.cms-submenu-item');
                      // eslint-disable-next-line no-unused-vars
                      const mostUsedPlugins = toPairs(pluginUsageMap).sort(([x, a], [y, b]) => a - b).reverse();
                      const MAX_MOST_USED_PLUGINS = 5;
              Severity: Minor
              Found in cms/static/cms/js/modules/cms.plugins.js - About 1 hr to fix

                Function bindPluginKeys has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var bindPluginKeys = function () {
                    keyboard.setContext('plugins');
                    keyboard.bind('escape', function () {
                        var plugin = $('.cms-dragitem:focus');
                        var area = plugin.closest('.cms-dragarea');
                Severity: Minor
                Found in cms/static/cms/js/modules/shortcuts/placeholders.js - About 1 hr to fix

                  Function toggleColorScheme has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      toggleColorScheme: function () {
                          const currentTheme = this.getColorScheme();
                          const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
                  
                          if (prefersDark) {
                  Severity: Minor
                  Found in cms/static/cms/js/modules/cms.base.js - About 1 hr 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 _moveToDropdown has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

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

                      open: function open(opts) {
                          if (!(opts && opts.message)) {
                              throw new Error('The arguments passed to "open" were invalid.');
                          }
                  
                  
                  Severity: Minor
                  Found in cms/static/cms/js/modules/cms.messages.js - About 1 hr 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 __call__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def __call__(self, request):
                              response = self.get_response(request)
                              language = get_language()
                              if hasattr(request, 'session'):
                                  session_language = request.session.get(LANGUAGE_SESSION_KEY, None)
                  Severity: Minor
                  Found in cms/middleware/language.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def handle(self, *args, **options):
                          if options[self.subcommand_dest] in self.instances:
                              command = self.instances[options[self.subcommand_dest]]
                              if options.get('no_color'):
                                  command.style = no_style()
                  Severity: Minor
                  Found in cms/management/commands/subcommands/base.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def clean(self):
                          data = super().clean()
                  
                          if self._errors:
                              # Form already has errors, best to let those be
                  Severity: Minor
                  Found in cms/admin/forms.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def handle(self, *args, **options):
                          urls = list(
                              Page.objects.exclude(application_urls='').exclude(
                                  application_urls__isnull=True
                              ).values_list(
                  Severity: Minor
                  Found in cms/management/commands/subcommands/list.py - About 1 hr 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 _move_plugin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _move_plugin(self, request, plugin, target_language,
                                       target_placeholder, tree_order, target_parent=None):
                          if not self.has_move_plugin_permission(request, plugin, target_placeholder):
                              message = force_str(_("You have no permission to move this plugin"))
                              raise PermissionDenied(message)
                  Severity: Minor
                  Found in cms/admin/placeholderadmin.py - About 1 hr 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_available_slug has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_available_slug(site, path, language, suffix='copy', modified=False, current=None):
                      """
                      Generates slug for path.
                      If path is used, appends the value of suffix to the end.
                      """
                  Severity: Minor
                  Found in cms/utils/page.py - About 1 hr 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_bound_plugins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_bound_plugins(plugins):
                      get_plugin = plugin_pool.get_plugin
                      plugin_types_map = defaultdict(list)
                      plugin_ids = []
                      plugin_lookup = {}
                  Severity: Minor
                  Found in cms/utils/plugins.py - About 1 hr 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_reached_plugin_limit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def has_reached_plugin_limit(placeholder, plugin_type, language, template=None, parent_plugin=None):
                      """
                      Checks if placeholder has reached it's global plugin limit,
                      if not then it checks if it has reached it's plugin_type limit.
                      """
                  Severity: Minor
                  Found in cms/utils/plugins.py - About 1 hr 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 populate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def populate(self):
                          # always use draft if we have a page
                          self.page = get_page_draft(self.request.current_page)
                  
                          if not self.page:
                  Severity: Minor
                  Found in cms/test_utils/project/extensionapp/cms_toolbars.py - About 1 hr 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