codenothing/CSSTree

View on GitHub

Showing 30 of 30 total issues

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

(function($) {
    var caretClass = 'textarea-helper-caret',
        dataKey = 'textarea-helper'

        // Styles that could influence size of the mirrored element.
Severity: Major
Found in demo/counter/textarea.js and 1 other location - About 5 days to fix
demo/textarea.js on lines 3..119

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

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

(function($) {
    var caretClass = 'textarea-helper-caret',
        dataKey = 'textarea-helper'

        // Styles that could influence size of the mirrored element.
Severity: Major
Found in demo/textarea.js and 1 other location - About 5 days to fix
demo/counter/textarea.js on lines 3..119

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

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

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

    function select( start, end ) {
        var element = textarea[ 0 ], range;

        if ( start >= end ) {
            alert( 'Start Must Be Less Than End' );
Severity: Major
Found in demo/js.js and 1 other location - About 7 hrs to fix
demo/counter/js.js on lines 9..30

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

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 select( start, end ) {
        var element = textbox[ 0 ], range;

        if ( start >= end ) {
            alert( 'Start Must Be Less Than End' );
Severity: Major
Found in demo/counter/js.js and 1 other location - About 7 hrs to fix
demo/js.js on lines 36..57

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

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

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

    function scroll(){
        var current = textarea.scrollTop(),
            caret = textarea.textareaHelper( 'caretPos' ).top,
            height = textarea.height(),
            ypos = current + caret - parseInt( height / 2, 10 );
Severity: Major
Found in demo/js.js and 1 other location - About 3 hrs to fix
demo/counter/js.js on lines 33..44

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

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 scroll(){
        var current = textbox.scrollTop(),
            caret = textbox.textareaHelper( 'caretPos' ).top,
            height = textbox.height(),
            ypos = current + caret - parseInt( height / 2, 10 );
Severity: Major
Found in demo/counter/js.js and 1 other location - About 3 hrs to fix
demo/js.js on lines 60..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 106.

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

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

                    else if ( c == "\\" ) {
                        iter.skip();
                        selector += c + iter.c;
                    }
                    // Seek
        Severity: Major
        Found in lib/CSSTree.js and 1 other location - About 2 hrs to fix
        lib/CSSTree.js on lines 222..237

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

        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

                    else if ( c == '}' ) {
                        iter.reverse();
                        return false;
                    }
                    // Seek strings
        Severity: Major
        Found in lib/CSSTree.js and 1 other location - About 2 hrs to fix
        lib/CSSTree.js on lines 103..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 91.

        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

                        for ( ; ++i < l; ) {
                            c = value[ i ];
                            part += c;
        
                            // End char found, break off and attach part
        Severity: Major
        Found in lib/Rule.js and 1 other location - About 2 hrs to fix
        lib/AtRule.js on lines 49..61

        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

                        for ( ; ++i < l; ) {
                            c = atrule[ i ];
                            part += c;
        
                            // End char found, break off and attach part
        Severity: Major
        Found in lib/AtRule.js and 1 other location - About 2 hrs to fix
        lib/Rule.js on lines 52..64

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

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

                          if ( branch.position ) {
                              branch.highlight = "Range [" + branch.position.range.start + "," + branch.position.range.end + "]";
                          }
              Severity: Major
              Found in demo/js.js and 1 other location - About 1 hr to fix
              demo/js.js on lines 23..25

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

              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