codenothing/CSSCompressor

View on GitHub

Showing 254 of 254 total issues

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

    CSSCompressor.each( CSSCompressor.mode, function( mode, name ) {
        var display = name[ 0 ].toUpperCase() + name.substr( 1 );
        html += [
            "<option value='" + name + "'>" + display + "</option>"
        ].join( '' );
Severity: Major
Found in demo/js/home.js and 1 other location - About 2 hrs to fix
demo/js/home.js on lines 123..128

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

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

    CSSCompressor.each( CSSCompressor.format, function( format, name ) {
        var display = name[ 0 ].toUpperCase() + name.substr( 1 );
        html += [
            "<option value='" + name + "'>" + display + "</option>"
        ].join( '' );
Severity: Major
Found in demo/js/home.js and 1 other location - About 2 hrs to fix
demo/js/home.js on lines 113..118

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

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 liveHandler has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function liveHandler( event ) {
    var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
        elems = [],
        selectors = [],
        events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
Severity: Major
Found in demo/rules/js/jquery.js - About 2 hrs to fix

    Function clean has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        clean: function( elems, context, fragment, scripts ) {
            context = context || document;
    
            // !context.createElement fails in IE with an error but returns typeof 'object'
            if ( typeof context.createElement === "undefined" ) {
    Severity: Major
    Found in demo/rules/js/jquery.js - About 2 hrs to fix

      Function attr has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          attr: function( elem, name, value, pass ) {
              // don't set attributes on text and comment nodes
              if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
                  return undefined;
              }
      Severity: Major
      Found in demo/rules/js/jquery.js - About 2 hrs to fix

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

            callback: function( value, position, compressor ) {
                var m = rgradient.exec( value ),
                    before = value,
                    prefix = ( m || [] )[ 1 ] || '',
                    iter = new StringIterator( ( m || [] )[ 3 ] || '' ),
        Severity: Major
        Found in lib/rules/Gradient Compression.js - About 2 hrs to fix

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

              callback: function( rule, branch, compressor ) {
                  if ( rule.property == 'margin' || rule.property == 'padding' ) {
                      // Local copies
                      var before = rule.parts.slice( 0 ),
                          parts = rule.parts.slice( 0 );
          Severity: Minor
          Found in lib/rules/Margin, Padding Shorthand.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

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

                      for ( i in a ) {
                          if ( isArray( a[ i ] ) || isObject( a[ i ] ) ) {
                              if ( ! CSSCompressor.objectsMatch( a[ i ], b[ i ] ) ) {
                                  return false;
                              }
          Severity: Major
          Found in lib/Util.js and 1 other location - About 2 hrs to fix
          lib/Util.js on lines 134..143

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

          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

                      while ( i-- ) {
                          if ( isArray( a[ i ] ) || isObject( a[ i ] ) ) {
                              if ( ! CSSCompressor.objectsMatch( a[ i ], b[ i ] ) ) {
                                  return false;
                              }
          Severity: Major
          Found in lib/Util.js and 1 other location - About 2 hrs to fix
          lib/Util.js on lines 150..159

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

          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 ( next.position && branch.position ) {
                                  compressor.log(
                                      "Combining rule set on line " + next.position.start.line +
                                      " with ruleset on line " + branch.position.start.line +
                                      " as they share the same selector.",
          Severity: Major
          Found in lib/rules/Common Selectors.js and 1 other location - About 2 hrs to fix
          lib/rules/Common Rules.js on lines 72..79

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

          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 ( next.position && branch.position ) {
                                  compressor.log(
                                      "Combining rule set on line " + next.position.start.line +
                                      " with ruleset on line " + branch.position.start.line +
                                      " as they share the same rules.",
          Severity: Major
          Found in lib/rules/Common Rules.js and 1 other location - About 2 hrs to fix
          lib/rules/Common Selectors.js on lines 56..63

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

          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 callback has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              callback: function( rule, branch, compressor ) {
                  if ( ! rshortradiusprop.exec( rule.property ) || ! rule.parts || ! rule.parts.length ) {
                      return;
                  }
          
          
          Severity: Major
          Found in lib/rules/Border Radius Shorthand.js - About 2 hrs to fix

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

                callback: function( branch, compressor ) {
                    if ( ! branch.selector || ! branch.parts || ! branch.parts.length ) {
                        return;
                    }
            
            
            Severity: Minor
            Found in lib/rules/Class Attribute to Selector.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

            Function offset has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                jQuery.fn.offset = function( options ) {
                    var elem = this[0];
            
                    if ( options ) { 
                        return this.each(function( i ) {
            Severity: Major
            Found in demo/rules/js/jquery.js - About 2 hrs to fix

              Function callback has 54 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/Class Attribute to Selector.js - About 2 hrs to fix

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

                    callback: function( branches, compressor ) {
                        var index = -1, subindex = -1, branch, next;
                
                        for ( ; ++index < branches.length; ) {
                            branch = branches[ index ];
                Severity: Minor
                Found in lib/rules/Common Selectors.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

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

                    callback: function( branches, compressor ) {
                        var index = -1, subindex = -1, branch, next;
                
                        for ( ; ++index < branches.length; ) {
                            branch = branches[ index ];
                Severity: Minor
                Found in lib/rules/Common Rules.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

                Function callback has 52 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/Border, Outline Style Combinations.js - About 2 hrs to fix

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

                              branch.parts.forEach(function( part, i ) {
                                  var prev = branch.parts[ i - 1 ];
                  
                                  if ( selector.length && part != ',' ) {
                                      selector += ' ';
                  Severity: Major
                  Found in lib/formats/Minimum.js and 2 other locations - About 2 hrs to fix
                  lib/formats/Max.js on lines 81..89
                  lib/formats/Medium.js on lines 84..92

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

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

                              branch.parts.forEach(function( part, i ) {
                                  var prev = branch.parts[ i - 1 ];
                  
                                  if ( selector.length && part != ',' ) {
                                      selector += ' ';
                  Severity: Major
                  Found in lib/formats/Medium.js and 2 other locations - About 2 hrs to fix
                  lib/formats/Max.js on lines 81..89
                  lib/formats/Minimum.js on lines 85..93

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language