divio/django-cms

View on GitHub

Showing 579 of 869 total issues

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

def _show_placeholder_by_id(context, placeholder_name, reverse_id,
Severity: Minor
Found in cms/templatetags/cms_tags.py - About 45 mins to fix

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

        def _move_plugin(self, request, plugin, target_language,
    Severity: Minor
    Found in cms/admin/placeholderadmin.py - About 45 mins to fix

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

          def is_cms_request(self, request):
              toolbar_hide = get_cms_setting('TOOLBAR_HIDE')
              internal_ips = get_cms_setting('INTERNAL_IPS')
      
              if internal_ips:
      Severity: Minor
      Found in cms/middleware/toolbar.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 _update_descendants_tree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def _update_descendants_tree(self, root):
              nodes = TreeNode.objects.all()
              descendants_by_parent = OrderedDict()
      
              for descendant in get_descendants(root):
      Severity: Minor
      Found in cms/management/commands/subcommands/tree.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 _paste_plugin has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _paste_plugin(self, request, plugin, target_language,
      Severity: Minor
      Found in cms/admin/placeholderadmin.py - About 45 mins to fix

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

            def render_page_placeholder(self, slot, context, inherit,
        Severity: Minor
        Found in cms/plugin_rendering.py - About 45 mins to fix

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

              def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
          Severity: Minor
          Found in cms/admin/pageadmin.py - About 45 mins to fix

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

            def save_permissions(data, obj):
                models = (
                    (Page, 'page'),
                    (PageUser, 'pageuser'),
                    (PageUserGroup, 'pageuser'),
            Severity: Minor
            Found in cms/admin/forms.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_context has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def get_context(self, context, instance, language, view_url, view_method,
            Severity: Minor
            Found in cms/templatetags/cms_tags.py - About 45 mins to fix

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

                  def handle(self, *args, **options):
                      report = plugin_report()
                      self.stdout.write('==== Plugin report ==== \n\n')
                      self.stdout.write('There are %s plugin types in your database \n' % len(report))
                      for plugin in report:
              Severity: Minor
              Found in cms/management/commands/subcommands/list.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 render_cms_structure_js has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def render_cms_structure_js(context, renderer, obj):
                  markup_bits = []
                  static_placeholders = []
                  page_placeholders_by_slot = obj.rescan_placeholders()
                  declared_static_placeholders = obj.get_declared_static_placeholders(context)
              Severity: Minor
              Found in cms/templatetags/cms_js_tags.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_fieldsets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_fieldsets(self, request, obj=None):
                      """
                      Nobody can grant more than he haves, so check for user permissions
                      to Page and User model and render fieldset depending on them.
                      """
              Severity: Minor
              Found in cms/admin/useradmin.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

              Avoid deeply nested control flow statements.
              Open

                                      if self._check_unique_namespace_instance(application_namespace):
                                          # Looks like there's already one with the default instance
                                          # namespace defined.
                                          self._errors['application_namespace'] = ErrorList([
                                              _('An application instance with this name already exists.')
              Severity: Major
              Found in cms/admin/forms.py - About 45 mins to fix

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

                    def __init__(self, name, url, data=None, question=None, action='ajax', attributes=None):
                Severity: Minor
                Found in cms/plugin_base.py - About 45 mins to fix

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

                  def _get_block_nodes(extend_node, previous_context=None):
                      if not previous_context:
                          previous_context = get_context(extend_node)
                      parent = extend_node.get_parent(previous_context)
                      parent_nodelist = _get_nodelist(parent)
                  Severity: Minor
                  Found in cms/utils/placeholder.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 move_to_mp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def move_to_mp(apps, schema_editor):
                      db_alias = schema_editor.connection.alias
                  
                      Page = apps.get_model("cms", "Page")
                      CMSPlugin = apps.get_model("cms", "CMSPlugin")
                  Severity: Minor
                  Found in cms/migrations/0005_auto_20140924_1039.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

                  Avoid deeply nested control flow statements.
                  Open

                                      for lang in items:
                                          if lang['code'].find('_') > -1:
                                              section.warn("CMS_LANGUAGES entries must contain valid language codes, not locales (e.g.: "
                                                           "'en-us' instead of 'en_US'): '%s' provided" % lang['code'])
                          else:
                  Severity: Major
                  Found in cms/utils/check.py - About 45 mins to fix

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

                        def clean(self):
                            data = self.cleaned_data
                    
                            obj_id = data.get('obj_id')
                            obj_type = data.get('obj_type')
                    Severity: Minor
                    Found in cms/admin/forms.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 cms/cms_menus.py - About 45 mins to fix

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

                      def send_mail(subject, txt_template, to, context=None, html_template=None, fail_silently=True):
                      Severity: Minor
                      Found in cms/utils/mail.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language