divio/django-cms

View on GitHub
cms/static/cms/js/modules/shortcuts/placeholders.js

Summary

Maintainability
D
2 days
Test Coverage

Function bindPlaceholderKeys has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var bindPlaceholderKeys = function () {
    keyboard.setContext('placeholders');
    keyboard.bind('escape', function () {
        $('.cms-structure .cms-dragarea').removeAttr('tabindex');
        $('.cms-structure-content').untrap();
Severity: Minor
Found in cms/static/cms/js/modules/shortcuts/placeholders.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

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

      var bindPlaceholderActionKeys = function () {
          keyboard.setContext('placeholder-actions');
          keyboard.bind('escape', function () {
              var dropdown = $('.cms-dropdown-inner:visible');
              var area = dropdown.closest('.cms-dragarea');
      Severity: Major
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 1 other location - About 4 hrs to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 139..150

      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 120.

      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

      var bindPluginActionKeys = function () {
          keyboard.setContext('plugin-actions');
          keyboard.bind('escape', function () {
              var dropdown = $('.cms-dropdown-inner:visible');
              var plugin = dropdown.closest('.cms-dragitem');
      Severity: Major
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 1 other location - About 4 hrs to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 71..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 120.

      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

          keyboard.bind(['!', 's'], function () {
              var area = $('.cms-dragarea:focus');
      
              area.find('.cms-submenu-settings:first').trigger('pointerup');
              keyboard.setContext('placeholder-actions');
      Severity: Major
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 1 other location - About 3 hrs to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 122..129

      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 97.

      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

          keyboard.bind(['!', 's'], function () {
              var plugin = $('.cms-dragitem:focus');
      
              plugin.find('.cms-submenu-settings:first').trigger('pointerup');
              keyboard.setContext('plugin-actions');
      Severity: Major
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 1 other location - About 3 hrs to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 53..60

      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 97.

      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

          keyboard.bind(['+', 'a'], function () {
              var plugin = $('.cms-dragitem:focus');
      
              plugin.find('.cms-submenu-add:first').trigger('pointerup');
          });
      Severity: Minor
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 1 other location - About 45 mins to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 41..45

      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 50.

      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

          keyboard.bind(['+', 'a'], function () {
              var area = $('.cms-dragarea:focus');
      
              area.find('.cms-submenu-add:first').trigger('pointerup');
          });
      Severity: Minor
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 1 other location - About 45 mins to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 112..116

      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 50.

      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

          keyboard.bind('e', function () {
              var plugin = $('.cms-dragitem:focus');
      
              plugin.find('.cms-submenu-edit').trigger('click');
          });
      Severity: Minor
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 2 other locations - About 35 mins to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 47..51
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 117..121

      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 47.

      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

          keyboard.bind('x', function () {
              var plugin = $('.cms-dragitem:focus');
      
              plugin.find('.cms-dragitem-text').trigger('click');
          });
      Severity: Minor
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 2 other locations - About 35 mins to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 47..51
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 107..111

      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 47.

      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

          keyboard.bind('x', function () {
              var area = $('.cms-dragarea:focus');
      
              area.find('.cms-dragbar-toggler a:visible').trigger('click');
          });
      Severity: Minor
      Found in cms/static/cms/js/modules/shortcuts/placeholders.js and 2 other locations - About 35 mins to fix
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 107..111
      cms/static/cms/js/modules/shortcuts/placeholders.js on lines 117..121

      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 47.

      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