codenothing/CSSCompressor

View on GitHub

Showing 254 of 254 total issues

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/Max.js and 2 other locations - About 2 hrs to fix
lib/formats/Medium.js on lines 84..92
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

Function callback has 51 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/List Style Combinations.js - About 2 hrs to fix

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

        callback: function( value, position, compressor ) {
            var m = rcalc.exec( value ),
                before = value,
                prefix = ( m || [] )[ 1 ] || '',
                iter = new StringIterator( ( m || [] )[ 3 ] || '' ),
    Severity: Minor
    Found in lib/rules/Calc Units.js - About 1 hr to fix

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

              if ( jQuery.isFunction(value) ) {
                  return this.each(function(i) {
                      var self = jQuery(this);
                      self.removeClass( value.call(this, i, self.attr("class")) );
                  });
      Severity: Major
      Found in demo/rules/js/jquery.js and 1 other location - About 1 hr to fix
      demo/rules/js/jquery.js on lines 1465..1470

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

      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 ( jQuery.isFunction(value) ) {
                  return this.each(function(i) {
                      var self = jQuery(this);
                      self.addClass( value.call(this, i, self.attr("class")) );
                  });
      Severity: Major
      Found in demo/rules/js/jquery.js and 1 other location - About 1 hr to fix
      demo/rules/js/jquery.js on lines 1501..1506

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

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

          rule: function( options, type, callback ) {
              var rules = CSSCompressor._rules;
      
              // Passing no arguments returns the entire list
              if ( options === undefined ) {
      Severity: Minor
      Found in lib/Rules.js - About 1 hr to fix

        Function domManip has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            domManip: function( args, table, callback ) {
                var results, first, fragment, parent,
                    value = args[0],
                    scripts = [];
        
        
        Severity: Minor
        Found in demo/rules/js/jquery.js - About 1 hr to fix

          Function closest has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              closest: function( selectors, context ) {
                  var ret = [], i, l, cur = this[0];
          
                  if ( jQuery.isArray( selectors ) ) {
                      var match, selector,
          Severity: Minor
          Found in demo/rules/js/jquery.js - About 1 hr to fix

            Function CHILD has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    CHILD: function( elem, match ) {
                        var type = match[1],
                            node = elem;
            
                        switch ( type ) {
            Severity: Minor
            Found in demo/rules/js/jquery.js - About 1 hr to fix

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

                          event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
              Severity: Major
              Found in demo/rules/js/jquery.js and 1 other location - About 1 hr to fix
              demo/rules/js/jquery.js on lines 2319..2319

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

              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 ( jQuery.isFunction(text) ) {
                          return this.each(function(i) {
                              var self = jQuery( this );
              
                              self.text( text.call(this, i, self.text()) );
              Severity: Major
              Found in demo/rules/js/jquery.js and 1 other location - About 1 hr to fix
              demo/rules/js/jquery.js on lines 7142..7147

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

              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

                          event.pageY = event.clientY + (doc && doc.scrollTop  || body && body.scrollTop  || 0) - (doc && doc.clientTop  || body && body.clientTop  || 0);
              Severity: Major
              Found in demo/rules/js/jquery.js and 1 other location - About 1 hr to fix
              demo/rules/js/jquery.js on lines 2318..2318

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

              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 ( jQuery.isFunction( size ) ) {
                          return this.each(function( i ) {
                              var self = jQuery( this );
                              self[ type ]( size.call( this, i, self[ type ]() ) );
                          });
              Severity: Major
              Found in demo/rules/js/jquery.js and 1 other location - About 1 hr to fix
              demo/rules/js/jquery.js on lines 4656..4662

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

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

                      var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
                          // The request was aborted
                          if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
                              // Opera doesn't call onreadystatechange before this point
                              // so we simulate the call
              Severity: Minor
              Found in demo/rules/js/jquery.js - About 1 hr to fix

                Function extend has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                CSSCompressor.extend = function(){
                    var args = Slice.call( arguments ), i = -1, l = args.length, deep = false, target = this, name, copy;
                
                    // Check for deep copy
                    if ( CSSCompressor.isBoolean( args[ 0 ] ) ) {
                Severity: Minor
                Found in lib/Util.js - About 1 hr 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 name has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
                        var type, i = 0, match, namespaces, preType,
                            selector = origSelector || this.selector,
                            context = origSelector ? this : jQuery( this.context );
                        
                Severity: Minor
                Found in demo/rules/js/jquery.js - About 1 hr to fix

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

                          parts.forEach(function( a, i ) {
                              newparts.push.apply( newparts, a );
                  
                              if ( i < parts.length - 1 ) {
                                  newparts.push( ',' );
                  Severity: Major
                  Found in lib/rules/Comma Repeats.js and 1 other location - About 1 hr to fix
                  lib/rules/Strict ID.js on lines 111..117

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

                  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

                          newCommaParts.forEach(function( a, i ) {
                              parts.push.apply( parts, a );
                  
                              if ( i < newCommaParts.length - 1 ) {
                                  parts.push( ',' );
                  Severity: Major
                  Found in lib/rules/Strict ID.js and 1 other location - About 1 hr to fix
                  lib/rules/Comma Repeats.js on lines 65..71

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

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

                      handle: function( event ) {
                          var all, handlers, namespaces, namespace_re, events,
                              namespace_sort = [],
                              args = jQuery.makeArray( arguments );
                  
                  
                  Severity: Minor
                  Found in demo/rules/js/jquery.js - About 1 hr to fix

                    Function step has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        step: function( gotoEnd ) {
                            var t = jQuery.now(), done = true;
                    
                            if ( gotoEnd || t >= this.options.duration + this.startTime ) {
                                this.now = this.end;
                    Severity: Minor
                    Found in demo/rules/js/jquery.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language