insideout10/wordlift-plugin-js

View on GitHub
app/admin_files/wp-fullscreen.js

Summary

Maintainability
D
3 days
Test Coverage

File wp-fullscreen.js has 491 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global ajaxurl, deleteUserSetting, setUserSetting, switchEditors, tinymce, tinyMCEPreInit, wp_fullscreen_settings, wpActiveEditor:true, wpLink */
/**
 * PubSub
 *
 * A lightweight publish/subscribe implementation.
Severity: Minor
Found in app/admin_files/wp-fullscreen.js - About 7 hrs to fix

    Function init has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            init: function() {
                var topbar = $('#fullscreen-topbar'), txtarea = $('#wp_mce_fullscreen'), last = 0;
    
                s.toolbars = topbar.add( $('#wp-fullscreen-status') );
                s.element = $('#fullscreen-fader');
    Severity: Major
    Found in app/admin_files/wp-fullscreen.js - About 2 hrs to fix

      Function unsubscribe has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      PubSub.prototype.unsubscribe = function( topic, callback ) {
          var i, l,
              topics = this.topics[ topic ];
      
          if ( ! topics )
      Severity: Minor
      Found in app/admin_files/wp-fullscreen.js - 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

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

                      txtarea.keyup( function(e) {
                          var k = e.keyCode || e.charCode;
      
                          if ( k == last )
                              return true;
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 1 other location - About 3 hrs to fix
      app/admin_files/post.js on lines 775..786

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

      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 ( s.mode === 'html' ) {
                  $('#wp-fullscreen-mode-bar').removeClass('wp-tmce-mode').addClass('wp-html-mode');
      
                  if ( fade )
                      $('#wp-fullscreen-button-bar').fadeOut( 150, function(){
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 1 other location - About 2 hrs to fix
      app/admin_files/wp-fullscreen.js on lines 503..512

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

      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

              } else if ( s.mode === 'tinymce' ) {
                  $('#wp-fullscreen-mode-bar').removeClass('wp-html-mode').addClass('wp-tmce-mode');
      
                  if ( fade )
                      $('#wp-fullscreen-button-bar').fadeOut( 150, function(){
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 1 other location - About 2 hrs to fix
      app/admin_files/wp-fullscreen.js on lines 493..512

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

      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 7 locations. Consider refactoring.
      Open

          api.ol = function() {
              if ( s.has_tinymce && 'tinymce' === s.mode )
                  tinymce.execCommand('InsertOrderedList');
          };
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 6 other locations - About 35 mins to fix
      app/admin_files/wp-fullscreen.js on lines 443..446
      app/admin_files/wp-fullscreen.js on lines 448..451
      app/admin_files/wp-fullscreen.js on lines 465..468
      app/admin_files/wp-fullscreen.js on lines 470..473
      app/admin_files/wp-fullscreen.js on lines 475..478
      app/admin_files/wp-fullscreen.js on lines 480..483

      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 7 locations. Consider refactoring.
      Open

          api.blockquote = function() {
              if ( s.has_tinymce && 'tinymce' === s.mode )
                  tinymce.execCommand('mceBlockQuote');
          };
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 6 other locations - About 35 mins to fix
      app/admin_files/wp-fullscreen.js on lines 443..446
      app/admin_files/wp-fullscreen.js on lines 448..451
      app/admin_files/wp-fullscreen.js on lines 453..456
      app/admin_files/wp-fullscreen.js on lines 465..468
      app/admin_files/wp-fullscreen.js on lines 470..473
      app/admin_files/wp-fullscreen.js on lines 475..478

      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 7 locations. Consider refactoring.
      Open

          api.atd = function() {
              if ( s.has_tinymce && 'tinymce' === s.mode )
                  tinymce.execCommand('mceWritingImprovementTool');
          };
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 6 other locations - About 35 mins to fix
      app/admin_files/wp-fullscreen.js on lines 443..446
      app/admin_files/wp-fullscreen.js on lines 448..451
      app/admin_files/wp-fullscreen.js on lines 453..456
      app/admin_files/wp-fullscreen.js on lines 465..468
      app/admin_files/wp-fullscreen.js on lines 475..478
      app/admin_files/wp-fullscreen.js on lines 480..483

      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 7 locations. Consider refactoring.
      Open

          api.i = function() {
              if ( s.has_tinymce && 'tinymce' === s.mode )
                  tinymce.execCommand('Italic');
          };
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 6 other locations - About 35 mins to fix
      app/admin_files/wp-fullscreen.js on lines 448..451
      app/admin_files/wp-fullscreen.js on lines 453..456
      app/admin_files/wp-fullscreen.js on lines 465..468
      app/admin_files/wp-fullscreen.js on lines 470..473
      app/admin_files/wp-fullscreen.js on lines 475..478
      app/admin_files/wp-fullscreen.js on lines 480..483

      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 7 locations. Consider refactoring.
      Open

          api.unlink = function() {
              if ( s.has_tinymce && 'tinymce' === s.mode )
                  tinymce.execCommand('unlink');
          };
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 6 other locations - About 35 mins to fix
      app/admin_files/wp-fullscreen.js on lines 443..446
      app/admin_files/wp-fullscreen.js on lines 448..451
      app/admin_files/wp-fullscreen.js on lines 453..456
      app/admin_files/wp-fullscreen.js on lines 470..473
      app/admin_files/wp-fullscreen.js on lines 475..478
      app/admin_files/wp-fullscreen.js on lines 480..483

      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 7 locations. Consider refactoring.
      Open

          api.help = function() {
              if ( s.has_tinymce && 'tinymce' === s.mode )
                  tinymce.execCommand('WP_Help');
          };
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 6 other locations - About 35 mins to fix
      app/admin_files/wp-fullscreen.js on lines 443..446
      app/admin_files/wp-fullscreen.js on lines 448..451
      app/admin_files/wp-fullscreen.js on lines 453..456
      app/admin_files/wp-fullscreen.js on lines 465..468
      app/admin_files/wp-fullscreen.js on lines 470..473
      app/admin_files/wp-fullscreen.js on lines 480..483

      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 7 locations. Consider refactoring.
      Open

          api.ul = function() {
              if ( s.has_tinymce && 'tinymce' === s.mode )
                  tinymce.execCommand('InsertUnorderedList');
          };
      Severity: Major
      Found in app/admin_files/wp-fullscreen.js and 6 other locations - About 35 mins to fix
      app/admin_files/wp-fullscreen.js on lines 443..446
      app/admin_files/wp-fullscreen.js on lines 453..456
      app/admin_files/wp-fullscreen.js on lines 465..468
      app/admin_files/wp-fullscreen.js on lines 470..473
      app/admin_files/wp-fullscreen.js on lines 475..478
      app/admin_files/wp-fullscreen.js on lines 480..483

      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