divio/django-cms

View on GitHub
cms/admin/placeholderadmin.py

Summary

Maintainability
F
6 days
Test Coverage

File placeholderadmin.py has 940 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import uuid
import warnings

from django.conf.urls import url
Severity: Major
Found in cms/admin/placeholderadmin.py - About 2 days to fix

    PlaceholderAdminMixin has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PlaceholderAdminMixin(object):
    
        def _get_attached_admin(self, placeholder):
            return placeholder._get_attached_admin(admin_site=self.admin_site)
    
    
    Severity: Minor
    Found in cms/admin/placeholderadmin.py - About 3 hrs to fix

      Function move_plugin has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def move_plugin(self, request):
              """
              Performs a move or a "paste" operation (when «move_a_copy» is set)
      
              POST request with following parameters:
      Severity: Minor
      Found in cms/admin/placeholderadmin.py - About 3 hrs 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_text(_("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 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 delete_plugin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def delete_plugin(self, request, plugin_id):
              plugin = self._get_plugin_from_id(plugin_id)
      
              if not self.has_delete_plugin_permission(request, plugin):
                  return HttpResponseForbidden(force_text(
      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 clear_placeholder has a Cognitive Complexity of 9 (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 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 _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 _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 _paste_placeholder has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Avoid too many return statements within this function.
            Open

                    return render(request, 'admin/cms/page/plugin/change_form.html', context)
            Severity: Major
            Found in cms/admin/placeholderadmin.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return HttpResponse(data, content_type='application/json')
              Severity: Major
              Found in cms/admin/placeholderadmin.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return TemplateResponse(request, "admin/cms/page/plugin/delete_confirmation.html", context)
                Severity: Major
                Found in cms/admin/placeholderadmin.py - About 30 mins to fix

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

                      def copy_plugins(self, request):
                          """
                          POST request should have the following data:
                  
                          - cms_path
                  Severity: Minor
                  Found in cms/admin/placeholderadmin.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 add_plugin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def add_plugin(self, request):
                          """
                          Shows the add plugin form and saves it on POST.
                  
                          Requires the following GET parameters:
                  Severity: Minor
                  Found in cms/admin/placeholderadmin.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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if not cancel_clicked and request.method == 'POST':
                              form = form_class(instance=obj, data=request.POST)
                              if form.is_valid():
                                  form.save()
                                  saved_successfully = True
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 1 other location - About 3 hrs to fix
                  cms/admin/pageadmin.py on lines 1631..1637

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 69.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          top_plugins_pks = [p[0].pk for p in sorted(top_plugins, key=lambda pair: pair[1].position)]
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 1 other location - About 1 hr to fix
                  cms/admin/placeholderadmin.py on lines 524..524

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 43.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          top_plugins_pks = [p[0].pk for p in sorted(top_plugins, key=lambda pair: pair[1].position)]
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 1 other location - About 1 hr to fix
                  cms/admin/placeholderadmin.py on lines 828..828

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 43.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          pre_placeholder_operation.send(
                              sender=self.__class__,
                              operation=operation,
                              request=request,
                              language=self._get_operation_language(request),
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 1 other location - About 1 hr to fix
                  cms/admin/placeholderadmin.py on lines 205..211

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 42.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          post_placeholder_operation.send(
                              sender=self.__class__,
                              operation=operation,
                              request=request,
                              language=self._get_operation_language(request),
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 1 other location - About 1 hr to fix
                  cms/admin/placeholderadmin.py on lines 189..195

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 42.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 4 locations. Consider refactoring.
                  Open

                          pat = lambda regex, fn: url(regex, self.admin_site.admin_view(fn), name='%s_%s' % (info, fn.__name__))
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 3 other locations - About 1 hr to fix
                  cms/admin/pageadmin.py on lines 178..178
                  cms/admin/pageadmin.py on lines 1696..1696
                  cms/admin/placeholderadmin.py on lines 82..82

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 40.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 4 locations. Consider refactoring.
                  Open

                          pat = lambda regex, fn: url(regex, self.admin_site.admin_view(fn), name='%s_%s' % (info, fn.__name__))
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 3 other locations - About 1 hr to fix
                  cms/admin/pageadmin.py on lines 178..178
                  cms/admin/pageadmin.py on lines 1696..1696
                  cms/admin/placeholderadmin.py on lines 228..228

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 40.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                          if perms_needed or protected:
                              title = _("Cannot delete %(name)s") % {"name": obj_display}
                          else:
                              title = _("Are you sure?")
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 2 other locations - About 1 hr to fix
                  cms/admin/pageadmin.py on lines 471..474
                  cms/admin/placeholderadmin.py on lines 1093..1096

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 38.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                          if perms_needed or protected:
                              title = _("Cannot delete %(name)s") % {"name": plugin_name}
                          else:
                              title = _("Are you sure?")
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 2 other locations - About 1 hr to fix
                  cms/admin/pageadmin.py on lines 471..474
                  cms/admin/placeholderadmin.py on lines 1175..1178

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 38.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          if not self.has_move_plugin_permission(request, plugin, target_placeholder):
                              message = force_text(_("You have no permission to cut this plugin"))
                              raise PermissionDenied(message)
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 3 other locations - About 50 mins to fix
                  cms/admin/placeholderadmin.py on lines 742..744
                  cms/admin/placeholderadmin.py on lines 802..804
                  cms/admin/placeholderadmin.py on lines 864..866

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 36.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          if not self.has_copy_from_clipboard_permission(request, target_placeholder, plugins):
                              message = force_text(_("You have no permission to paste this placeholder"))
                              raise PermissionDenied(message)
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 3 other locations - About 50 mins to fix
                  cms/admin/placeholderadmin.py on lines 742..744
                  cms/admin/placeholderadmin.py on lines 864..866
                  cms/admin/placeholderadmin.py on lines 963..965

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 36.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          if not self.has_move_plugin_permission(request, plugin, target_placeholder):
                              message = force_text(_("You have no permission to move this plugin"))
                              raise PermissionDenied(message)
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 3 other locations - About 50 mins to fix
                  cms/admin/placeholderadmin.py on lines 742..744
                  cms/admin/placeholderadmin.py on lines 802..804
                  cms/admin/placeholderadmin.py on lines 963..965

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 36.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          if not self.has_copy_from_clipboard_permission(request, target_placeholder, plugins):
                              message = force_text(_("You have no permission to paste this plugin"))
                              raise PermissionDenied(message)
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py and 3 other locations - About 50 mins to fix
                  cms/admin/placeholderadmin.py on lines 802..804
                  cms/admin/placeholderadmin.py on lines 864..866
                  cms/admin/placeholderadmin.py on lines 963..965

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 36.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if not self.has_copy_plugins_permission(request, old_plugins):
                              message = _('You do not have permission to copy this placeholder.')
                              raise PermissionDenied(force_text(message))
                  Severity: Minor
                  Found in cms/admin/placeholderadmin.py and 1 other location - About 45 mins to fix
                  cms/admin/placeholderadmin.py on lines 429..431

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if not self.has_copy_plugins_permission(request, old_plugins):
                              message = _('You do not have permission to copy these plugins.')
                              raise PermissionDenied(force_text(message))
                  Severity: Minor
                  Found in cms/admin/placeholderadmin.py and 1 other location - About 45 mins to fix
                  cms/admin/placeholderadmin.py on lines 450..452

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status