codenothing/CSSCompressor

View on GitHub

Showing 254 of 254 total issues

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

        "~": function( checkSet, part, isXML ) {
            var nodeCheck,
                doneName = done++,
                checkFn = dirCheck;

Severity: Major
Found in demo/rules/js/jquery.js and 1 other location - About 3 hrs to fix
demo/rules/js/jquery.js on lines 3411..3423

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

        "": function(checkSet, part, isXML){
            var nodeCheck,
                doneName = done++,
                checkFn = dirCheck;

Severity: Major
Found in demo/rules/js/jquery.js and 1 other location - About 3 hrs to fix
demo/rules/js/jquery.js on lines 3425..3437

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

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

            branch.parts.forEach(function( part, i ) {
                if ( part === ',' ) {
                    sections.push( section = [] );
                    return;
                }
Severity: Major
Found in lib/formats/Minimum.js and 1 other location - About 3 hrs to fix
lib/formats/Medium.js on lines 24..34

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

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

            branch.parts.forEach(function( part, i ) {
                if ( part === ',' ) {
                    sections.push( section = [] );
                    return;
                }
Severity: Major
Found in lib/formats/Medium.js and 1 other location - About 3 hrs to fix
lib/formats/Minimum.js on lines 24..34

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

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 ( before.length != section.length ) {
                sections[ index ] = section;
                compressor.log(
                    "Combining " + rule.property + " directionals " + 
                    " '" + before.join( ' ' ) + "' => '" + section.join( ' ' ) + "'",
Severity: Major
Found in lib/rules/Border Radius Shorthand.js and 1 other location - About 3 hrs to fix
lib/rules/Margin, Padding Shorthand.js on lines 68..75

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

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 ( before.length !== parts.length ) {
                rule.parts = parts;
                compressor.log(
                    "Combining directionals for '" + rule.property + "'" + 
                    " '" + before.join( ' ' ) + "' => '" + parts.join( ' ' ) + "'",
Severity: Major
Found in lib/rules/Margin, Padding Shorthand.js and 1 other location - About 3 hrs to fix
lib/rules/Border Radius Shorthand.js on lines 90..97

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

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

File home.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * WARNING! This control file is a giant mess. Read at your own risk.
 * TODO: Organize this file
 */
function prettySettingsJSON( settings ) {
Severity: Minor
Found in demo/js/home.js - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

    if ( "getBoundingClientRect" in document.documentElement ) {
        jQuery.fn.offset = function( options ) {
            var elem = this[0], box;
    
            if ( options ) { 
    Severity: Critical
    Found in demo/rules/js/jquery.js - About 3 hrs to fix

      Function Cli has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Cli( ARGS ) {
          var args = argv.clear()
                  .info( "Usage: cssc [options] file.css" )
                  .version( 'v' + CSSCompressor.version )
                  .option( ARGVOptions )
      Severity: Major
      Found in lib/Cli.js - About 3 hrs to fix

        Function animate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            animate: function( prop, speed, easing, callback ) {
                var optall = jQuery.speed(speed, easing, callback);
        
                if ( jQuery.isEmptyObject( prop ) ) {
                    return this.each( optall.complete );
        Severity: Major
        Found in demo/rules/js/jquery.js - About 2 hrs to fix

          Function trigger has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              trigger: function( event, data, elem /*, bubbling */ ) {
                  // Event object or event type
                  var type = event.type || event,
                      bubbling = arguments[3];
          
          
          Severity: Major
          Found in demo/rules/js/jquery.js - About 2 hrs to fix

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

                callback: function( branch, compressor ) {
                    if ( ! branch.selector || ! branch.parts || ! branch.parts.length ) {
                        return;
                    }
            
            
            Severity: Major
            Found in lib/rules/Strict ID.js - About 2 hrs to fix

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

                  callback: function( branch, compressor ) {
                      if ( ! branch.rules || ! branch.rules.length ) {
                          return;
                      }
              
              
              Severity: Major
              Found in lib/rules/Font Combinations.js - About 2 hrs to fix

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

                                if ( parts[ 0 ] === parts[ 1 ] && parts[ 1 ] === parts[ 2 ] && parts[ 2 ] === parts[ 3 ] ) {
                                    parts = [ parts[ 0 ] ];
                                }
                                // '3px 2px 3px 2px' => '3px 2px'
                                else if ( parts [ 0 ] === parts[ 2 ] && parts[ 1 ] === parts[ 3 ] ) {
                Severity: Major
                Found in lib/rules/Margin, Padding Combinations.js and 1 other location - About 2 hrs to fix
                lib/rules/Border Radius Combinations.js on lines 184..194

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

                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 ( section[ 0 ] === section[ 1 ] && section[ 1 ] === section[ 2 ] && section[ 2 ] === section[ 3 ] ) {
                                        section = [ section[ 0 ] ];
                                    }
                                    // '3px 2px 3px 2px' => '3px 2px'
                                    else if ( section [ 0 ] === section[ 2 ] && section[ 1 ] === section[ 3 ] ) {
                Severity: Major
                Found in lib/rules/Border Radius Combinations.js and 1 other location - About 2 hrs to fix
                lib/rules/Margin, Padding Combinations.js on lines 111..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 90.

                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

                Function render has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function render( css, branches ) {
                    branches.forEach(function( branch, branchIndex ) {
                        var newparts = [], nextBranch = branches[ branchIndex + 1 ], selector = '';
                
                        // Comments
                Severity: Major
                Found in lib/formats/None.js - About 2 hrs to fix

                  Function val has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      val: function( value ) {
                          if ( !arguments.length ) {
                              var elem = this[0];
                  
                              if ( elem ) {
                  Severity: Major
                  Found in demo/rules/js/jquery.js - About 2 hrs to fix

                    Function filter has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Sizzle.filter = function( expr, set, inplace, not ) {
                        var match, anyFound,
                            old = expr,
                            result = [],
                            curLoop = set,
                    Severity: Major
                    Found in demo/rules/js/jquery.js - About 2 hrs to fix

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

                          init: function( selector, context ) {
                              var match, elem, ret, doc;
                      
                              // Handle $(""), $(null), or $(undefined)
                              if ( !selector ) {
                      Severity: Major
                      Found in demo/rules/js/jquery.js - About 2 hrs to fix

                        Function callback has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                            callback: function( branches, compressor ) {
                                function strip( array ) {
                                    for ( var i = -1, branch; ++i < array.length; ) {
                                        branch = array[ i ];
                        
                        
                        Severity: Minor
                        Found in lib/rules/Strip Empty Branches.js - About 2 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

                        Severity
                        Category
                        Status
                        Source
                        Language