phodal/congee

View on GitHub
ckeditor/plugins/lineutils/plugin.js

Summary

Maintainability
F
3 days
Test Coverage

File plugin.js has 526 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or http://ckeditor.com/license
 */

Severity: Major
Found in ckeditor/plugins/lineutils/plugin.js - About 1 day to fix

    Function pixelSearch has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            pixelSearch: ( function() {
                var contains = CKEDITOR.env.ie || CKEDITOR.env.webkit ?
                    function( el, found ) {
                        return el.contains( found );
                    } : function( el, found ) {
    Severity: Major
    Found in ckeditor/plugins/lineutils/plugin.js - About 2 hrs to fix

      Function Liner has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function Liner( editor, def ) {
              var editable = editor.editable();
      
              CKEDITOR.tools.extend( this, {
                  editor: editor,
      Severity: Major
      Found in ckeditor/plugins/lineutils/plugin.js - About 2 hrs to fix

        Function getStyle has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                getStyle: function( uid, type ) {
                    var rel = this.relations[ uid ],
                        loc = this.locations[ uid ][ type ],
                        styles = {},
                        hdiff;
        Severity: Minor
        Found in ckeditor/plugins/lineutils/plugin.js - About 1 hr to fix

          Function locate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  locate: ( function() {
                      function locateSibling( rel, type ) {
                          var sib = rel.element[ type === CKEDITOR.LINEUTILS_BEFORE ? 'getPrevious' : 'getNext' ]();
          
                          // Return the middle point between siblings.
          Severity: Minor
          Found in ckeditor/plugins/lineutils/plugin.js - About 1 hr to fix

            Function sort has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    sort: ( function() {
                        var locations, sorted,
                            dist, i;
            
                        function distance( y, uid, type ) {
            Severity: Minor
            Found in ckeditor/plugins/lineutils/plugin.js - About 1 hr to fix

              Function start has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      start: function( callback ) {
                          var that = this,
                              editor = this.editor,
                              doc = this.doc,
                              el, elfp, x, y;
              Severity: Minor
              Found in ckeditor/plugins/lineutils/plugin.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                                                if ( dist < sorted[ i ].dist ) {
                                                    sorted.splice( i, 0, { uid: +uid, type: type, dist: dist } );
                                                    break;
                                                }
                Severity: Major
                Found in ckeditor/plugins/lineutils/plugin.js - About 45 mins to fix

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

                              function iterate( el, xStart, yStart, step, condition ) {
                  Severity: Minor
                  Found in ckeditor/plugins/lineutils/plugin.js - About 35 mins to fix

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

                            showLine: function( line ) {
                                var uid = line.getUniqueId();
                    
                                line.show();
                    
                    
                    Severity: Major
                    Found in ckeditor/plugins/lineutils/plugin.js and 1 other location - About 1 hr to fix
                    ckeditor/plugins/lineutils/plugin.js on lines 736..743

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

                    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

                            hideLine: function( line ) {
                                var uid = line.getUniqueId();
                    
                                line.hide();
                    
                    
                    Severity: Major
                    Found in ckeditor/plugins/lineutils/plugin.js and 1 other location - About 1 hr to fix
                    ckeditor/plugins/lineutils/plugin.js on lines 750..757

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

                    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

                                tipLeftStyle: CKEDITOR.tools.writeCssText(
                                    CKEDITOR.tools.extend( {}, tipCss, {
                                        left: '0px',
                                        'border-left-color': 'red',
                                        'border-width': '6px 0 6px 6px'
                    Severity: Major
                    Found in ckeditor/plugins/lineutils/plugin.js and 1 other location - About 1 hr to fix
                    ckeditor/plugins/lineutils/plugin.js on lines 703..709

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

                    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

                                tipRightStyle: CKEDITOR.tools.writeCssText(
                                    CKEDITOR.tools.extend( {}, tipCss, {
                                        right: '0px',
                                        'border-right-color': 'red',
                                        'border-width': '6px 6px 6px 0'
                    Severity: Major
                    Found in ckeditor/plugins/lineutils/plugin.js and 1 other location - About 1 hr to fix
                    ckeditor/plugins/lineutils/plugin.js on lines 696..702

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

                    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 ( neg ) {
                                        this.traverseSearch( neg );
                    
                                        // Iterate towards DOM root until neg is a direct child of el.
                                        while ( !neg.getParent().equals( el ) ) {
                    Severity: Major
                    Found in ckeditor/plugins/lineutils/plugin.js and 1 other location - About 1 hr to fix
                    ckeditor/plugins/lineutils/plugin.js on lines 325..332

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

                    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 ( pos ) {
                                        this.traverseSearch( pos );
                    
                                        // Iterate towards DOM root until pos is a direct child of el.
                                        while ( !pos.getParent().equals( el ) ) {
                    Severity: Major
                    Found in ckeditor/plugins/lineutils/plugin.js and 1 other location - About 1 hr to fix
                    ckeditor/plugins/lineutils/plugin.js on lines 316..323

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

                    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 ( isStatic( el ) && el.isVisible() ) {
                                        // Collect all addresses yielded by lookups for that element.
                                        for ( l in this.lookups ) {
                                            if ( ( type = this.lookups[ l ]( el ) ) ) {
                                                this.store( el, type );
                    Severity: Minor
                    Found in ckeditor/plugins/lineutils/plugin.js and 1 other location - About 55 mins to fix
                    ckeditor/plugins/lineutils/plugin.js on lines 216..224

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

                    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 ( isStatic( el ) ) {
                                        // Collect all addresses yielded by lookups for that element.
                                        for ( l in this.lookups ) {
                    
                                            if ( ( type = this.lookups[ l ]( el ) ) ) {
                    Severity: Minor
                    Found in ckeditor/plugins/lineutils/plugin.js and 1 other location - About 55 mins to fix
                    ckeditor/plugins/lineutils/plugin.js on lines 394..401

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

                    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