insideout10/wordlift-plugin-js

View on GitHub
app/admin_files/quicktags.js

Summary

Maintainability
D
2 days
Test Coverage

File quicktags.js has 470 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global adminpage, wpActiveEditor, quicktagsL10n, wpLink, fullscreen, prompt */
/*
 * Quicktags
 *
 * This is the HTML editor in WordPress. It can be attached to any textarea and will
Severity: Minor
Found in app/admin_files/quicktags.js - About 7 hrs to fix

    Function callback has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        qt.TagButton.prototype.callback = function(element, canvas, ed) {
            var t = this, startPos, endPos, cursorPos, scrollTop, v = canvas.value, l, r, i, sel, endTag = v ? t.tagEnd : '';
    
            if ( document.selection ) { // IE
                canvas.focus();
    Severity: Major
    Found in app/admin_files/quicktags.js - About 2 hrs to fix

      Function _buttonsInit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          qt._buttonsInit = function() {
              var t = this, canvas, name, settings, theButtons, html, inst, ed, id, i, use,
                  defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,';
      
              for ( inst in t.instances ) {
      Severity: Minor
      Found in app/admin_files/quicktags.js - About 1 hr to fix

        Function _domReady has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var _domReady = function(func) {
                var t, i, DOMContentLoaded, _tryReady;
        
                if ( typeof jQuery !== 'undefined' ) {
                    jQuery(document).ready(func);
        Severity: Minor
        Found in app/admin_files/quicktags.js - About 1 hr to fix

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

              qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {
                  var btn;
          
                  if ( !id || !display ) {
                      return;
          Severity: Minor
          Found in app/admin_files/quicktags.js - About 1 hr to fix

            Function addButton has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {
            Severity: Major
            Found in app/admin_files/quicktags.js - About 1 hr to fix

              Function TagButton has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  qt.TagButton = function(id, display, tagStart, tagEnd, access, title, instance) {
              Severity: Major
              Found in app/admin_files/quicktags.js - About 50 mins to fix

                Function edButton has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function edButton(id, display, tagStart, tagEnd, access) {
                Severity: Minor
                Found in app/admin_files/quicktags.js - About 35 mins to fix

                  Function Button has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      qt.Button = function(id, display, access, title, instance) {
                  Severity: Minor
                  Found in app/admin_files/quicktags.js - About 35 mins to fix

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

                                    if ( !t.tagEnd ) {
                                        sel.text = t.tagStart;
                                    } else if ( t.isOpen(ed) === false ) {
                                        sel.text = t.tagStart;
                                        t.openTag(element, ed);
                    Severity: Major
                    Found in app/admin_files/quicktags.js and 1 other location - About 1 hr to fix
                    app/admin_files/quicktags.js on lines 511..519

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

                    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 ( !endTag ) {
                                    canvas.value += t.tagStart;
                                } else if ( t.isOpen(ed) !== false ) {
                                    canvas.value += t.tagStart;
                                    t.openTag(element, ed);
                    Severity: Major
                    Found in app/admin_files/quicktags.js and 1 other location - About 1 hr to fix
                    app/admin_files/quicktags.js on lines 464..472

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

                    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 ( 'rtl' === document.getElementsByTagName('html')[0].dir ) {
                                    theButtons.textdirection = new qt.TextDirectionButton();
                                    html += theButtons.textdirection.html(name + '_');
                                }
                    Severity: Minor
                    Found in app/admin_files/quicktags.js and 1 other location - About 30 mins to fix
                    app/admin_files/quicktags.js on lines 283..286

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

                    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 ( use && use.indexOf(',fullscreen,') !== -1 ) {
                                    theButtons.fullscreen = new qt.FullscreenButton();
                                    html += theButtons.fullscreen.html(name + '_');
                                }
                    Severity: Minor
                    Found in app/admin_files/quicktags.js and 1 other location - About 30 mins to fix
                    app/admin_files/quicktags.js on lines 289..292

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

                    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