codenothing/CSSCompressor

View on GitHub

Showing 179 of 254 total issues

Function callback has 34 lines of code (exceeds 25 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 1 hr to fix

    Function fix has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        fix: function( event ) {
            if ( event[ jQuery.expando ] ) {
                return event;
            }
    
    
    Severity: Minor
    Found in demo/rules/js/jquery.js - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                  if ( match[1] === "nth" ) {
                      // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
                      var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
                          match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
                          !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
      Severity: Critical
      Found in demo/rules/js/jquery.js - About 1 hr to fix

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

            callback: function( value, position, compressor ) {
                var m = rhsl.exec( value ),
                    str = '#',
                    h, s, l,
                    p, q;
        Severity: Minor
        Found in lib/rules/HSL to Hex.js - About 1 hr to fix

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

              callback: function( value, position, compressor ) {
                  var m = rrgb.exec( value ),
                      str = '#', values;
          
                  if ( m ) {
          Severity: Minor
          Found in lib/rules/RGB to Hex.js - About 1 hr to fix

            Function rule has a Cognitive Complexity of 11 (exceeds 5 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

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

                data: function( elem, name, data ) {
                    if ( !jQuery.acceptData( elem ) ) {
                        return;
                    }
            
            
            Severity: Minor
            Found in demo/rules/js/jquery.js - About 1 hr to fix

              Function each has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  each: function( object, callback, args ) {
                      var name, i = 0,
                          length = object.length,
                          isObj = length === undefined || jQuery.isFunction(object);
              
              
              Severity: Minor
              Found in demo/rules/js/jquery.js - About 1 hr to fix

                Function textSelection has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jQuery.fn.textSelection = function( start, end ) {
                    return this.each(function( i, element ) {
                        var textarea = jQuery( element ),
                            height = textarea.height(),
                            current, caret, ypos, range;
                Severity: Minor
                Found in demo/js/home.js - About 1 hr to fix

                  Function dirCheck has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
                      for ( var i = 0, l = checkSet.length; i < l; i++ ) {
                          var elem = checkSet[i];
                  
                          if ( elem ) {
                  Severity: Minor
                  Found in demo/rules/js/jquery.js - About 1 hr to fix

                    Function removeData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        removeData: function( elem, name ) {
                            if ( !jQuery.acceptData( elem ) ) {
                                return;
                            }
                    
                    
                    Severity: Minor
                    Found in demo/rules/js/jquery.js - About 1 hr to fix

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

                          callback: function( branch, compressor ) {
                              if ( ! branch.selector || ! branch.parts || ! branch.parts.length ) {
                                  return;
                              }
                      
                      
                      Severity: Minor
                      Found in lib/rules/Trim Selector Attribute Quotes.js - About 1 hr to fix

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

                            callback: function( branches, compressor ) {
                                var imports = [], charsets = [], pos = -1;
                        
                                // Find all import and charset declarations (after the first rule filled branch)
                                branches.forEach(function( branch, i ) {
                        Severity: Minor
                        Found in lib/rules/Order Atrules.js - About 1 hr to fix

                          Function setOffset has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              setOffset: function( elem, options, i ) {
                                  var position = jQuery.css( elem, "position" );
                          
                                  // set position first, in-case top/left are set even on static elem
                                  if ( position === "static" ) {
                          Severity: Minor
                          Found in demo/rules/js/jquery.js - About 1 hr to fix

                            Function _blocks has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                _blocks: function( branches ) {
                                    var self = this,
                                        rules = CSSCompressor.rule( CSSCompressor.RULE_TYPE_RULE ),
                                        blocks = CSSCompressor.rule( CSSCompressor.RULE_TYPE_BLOCK );
                            
                            
                            Severity: Minor
                            Found in lib/CSSCompressor.js - About 1 hr to fix

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

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

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

                                    callback: function( branch, compressor ) {
                                        if ( ! branch.selector || ! branch.parts || ! branch.parts.length ) {
                                            return;
                                        }
                                
                                
                                Severity: Minor
                                Found in lib/rules/ID Attribute to Selector.js - About 1 hr to fix

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

                                          ATTR: function( elem, match ) {
                                              var name = match[1],
                                                  result = Expr.attrHandle[ name ] ?
                                                      Expr.attrHandle[ name ]( elem ) :
                                                      elem[ name ] != null ?
                                  Severity: Minor
                                  Found in demo/rules/js/jquery.js - About 1 hr to fix

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

                                        callback: function( branch, compressor ) {
                                            if ( ! branch.selector || ! branch.parts || ! branch.parts.length ) {
                                                return;
                                            }
                                    
                                    
                                    Severity: Minor
                                    Found in lib/rules/Lowercase Selectors.js - About 1 hr to fix

                                      Function callback has a Cognitive Complexity of 10 (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/Comma Repeats.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language