codenothing/CSSTree

View on GitHub

Showing 15 of 30 total issues

Function breakdown has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    breakdown: function(){
        var self = this, selector = self.selector,
            parts = [], nested = null, part = '',
            i = -1, l = selector.length, c = '',
            innerSeek = null;
Severity: Minor
Found in lib/Selector.js - About 1 day 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 breakdown has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    breakdown: function(){
        var self = this, value = self.value,
            parts = [], i = -1, l = value.length, part = '', c, seek;

        for ( ; ++i < l; ) {
Severity: Minor
Found in lib/Rule.js - About 3 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 breakdown has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    breakdown: function(){
        var self = this, atrule = self.atrule,
            parts = [], part = '',
            i = -1, l = atrule.length, c = '',
            seek;
Severity: Minor
Found in lib/AtRule.js - About 3 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 breakdown has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    breakdown: function(){
        var self = this, selector = self.selector,
            parts = [], nested = null, part = '',
            i = -1, l = selector.length, c = '',
            innerSeek = null;
Severity: Major
Found in lib/Selector.js - About 3 hrs to fix

    Function nested has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        nested: function( atrule, position ) {
            var self = this,
                iter = self.iter,
                startPos = null,
                string = '',
    Severity: Major
    Found in lib/CSSTree.js - About 2 hrs to fix

      File CSSTree.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var rwhitespace = /(\s|\t|\r\n|\r|\n)/,
          leftTrim = /^(\r\n|\r|\n|\t|\s)*/,
          StringIterator = global.StringIterator;
      
      
      
      Severity: Minor
      Found in lib/CSSTree.js - About 2 hrs to fix

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

            selector: function(){
                var self = this,
                    iter = self.iter,
                    position = new CSSTree.Position( iter.index + 1 ),
                    selector = '',
        Severity: Minor
        Found in lib/CSSTree.js - About 1 hr to fix

          Function breakdown has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              breakdown: function(){
                  var self = this, value = self.value,
                      parts = [], i = -1, l = value.length, part = '', c, seek;
          
                  for ( ; ++i < l; ) {
          Severity: Minor
          Found in lib/Rule.js - About 1 hr to fix

            Function breakdown has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                breakdown: function(){
                    var self = this, atrule = self.atrule,
                        parts = [], part = '',
                        i = -1, l = atrule.length, c = '',
                        seek;
            Severity: Minor
            Found in lib/AtRule.js - About 1 hr to fix

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

                  rules: function( parentPos ) {
                      var self = this,
                          iter = self.iter,
                          rules = [],
                          rule, position;
              Severity: Minor
              Found in lib/CSSTree.js - About 1 hr to fix

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

                    value: function( position ) {
                        var self = this,
                            iter = self.iter,
                            value = '';
                
                
                Severity: Minor
                Found in lib/CSSTree.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if ( ! block.rules ) {
                                          block.rules = [];
                                      }
                  Severity: Major
                  Found in lib/CSSTree.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    for ( ; ++i < l; ) {
                                        c = value[ i ];
                                        part += c;
                    
                                        // End char found, break off and attach part
                    Severity: Major
                    Found in lib/Rule.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          for ( ; ++i < l; ) {
                                              c = selector[ i ];
                                              part += c;
                      
                                              if ( c == "\\" ) {
                      Severity: Major
                      Found in lib/Selector.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if ( c == seek ) {
                                                break;
                                            }
                                            // Skip over escaped values
                                            else if ( c == "\\" && atrule[ i + 1 ] ) {
                        Severity: Major
                        Found in lib/AtRule.js - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language