SimenB/stylint

View on GitHub

Showing 133 of 133 total issues

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

        it( 'undefined if colon found', function() {
            assert.equal( undefined, colonTest( 'background-image: ' ) )
            assert.equal( undefined, colonTest( 'margin: 0 auto' ) )
            assert.equal( undefined, colonTest( 'margin: 0 auto;' ) )
        } )
Severity: Major
Found in test/test.js and 6 other locations - About 1 hr to fix
test/test.js on lines 1335..1339
test/test.js on lines 1341..1345
test/test.js on lines 1347..1351
test/test.js on lines 1369..1373
test/test.js on lines 1382..1386
test/test.js on lines 1883..1887

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

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

        it( 'undefined if leading num not zero', function() {
            assert.equal( undefined, zeroTest( 'font-size: 1.1em' ) )
            assert.equal( undefined, zeroTest( 'transform rotate( 22.33deg )' ) )
            assert.equal( undefined, zeroTest( 'width 33.3333333%' ) )
        } )
Severity: Major
Found in test/test.js and 6 other locations - About 1 hr to fix
test/test.js on lines 708..712
test/test.js on lines 1335..1339
test/test.js on lines 1347..1351
test/test.js on lines 1369..1373
test/test.js on lines 1382..1386
test/test.js on lines 1883..1887

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

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

        it( 'undefined if no .\d in line', function() {
            assert.equal( undefined, zeroTest( 'margin auto' ) )
            assert.equal( undefined, zeroTest( '.className' ) )
            assert.equal( undefined, zeroTest( '.class.other-class' ) )
        } )
Severity: Major
Found in test/test.js and 6 other locations - About 1 hr to fix
test/test.js on lines 708..712
test/test.js on lines 1335..1339
test/test.js on lines 1341..1345
test/test.js on lines 1369..1373
test/test.js on lines 1382..1386
test/test.js on lines 1883..1887

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

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

        it( 'false if range', function() {
            assert.equal( undefined, zeroTest( 'for 0..9' ) )
            assert.equal( undefined, zeroTest( 'for 0...9' ) )
            assert.equal( undefined, zeroTest( 'for $ in (0..9)' ) )
        } )
Severity: Major
Found in test/test.js and 6 other locations - About 1 hr to fix
test/test.js on lines 708..712
test/test.js on lines 1335..1339
test/test.js on lines 1341..1345
test/test.js on lines 1347..1351
test/test.js on lines 1382..1386
test/test.js on lines 1883..1887

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

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

var getFiles = function( dir ) {
    if ( typeof dir !== 'string' && !( dir instanceof Array ) ) {
        throw new TypeError( 'getFiles err. Expected string or array, but received: ' + typeof dir )
    }

Severity: Minor
Found in src/utils/getFiles.js - About 1 hr to fix

    Function valid has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function valid( line ) {
        // from and to are valid keyframes properties, but not outside that context
        if ( !this.state.keyframes && line.match( keyRe ) ) { return }
    
        // 1 split by tabs and spaces, tabs mess with pattern matching
    Severity: Minor
    Found in src/checks/valid.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 colons has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var colons = function( line ) {
        if ( ignoreRe.test( line ) || this.state.context === 0 ) { return }
    
        var colon
        var hasPseudo = false
    Severity: Minor
    Found in src/checks/colons.js - About 1 hr to fix

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

              it( 'true if * is found', function() {
                  assert.ok( universalTest( '*' ) )
                  assert.ok( universalTest( '*:before' ) )
                  assert.ok( universalTest( '*::after' ) )
              } )
      Severity: Major
      Found in test/test.js and 2 other locations - About 1 hr to fix
      test/test.js on lines 1656..1660
      test/test.js on lines 1662..1666

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

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

              it( 'true (err) if outline 0 or not applicable', function() {
                  assert.ok( noneTest( 'outline 0' ) )
                  assert.ok( noneTest( 'outline: 0' ) )
                  assert.ok( noneTest( 'outline:0' ) )
              } )
      Severity: Major
      Found in test/test.js and 2 other locations - About 1 hr to fix
      test/test.js on lines 1656..1660
      test/test.js on lines 2186..2190

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

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

              it( 'true (err) if border 0 or not applicable', function() {
                  assert.ok( noneTest( 'border 0' ) )
                  assert.ok( noneTest( 'border: 0' ) )
                  assert.ok( noneTest( 'border:0' ) )
              } )
      Severity: Major
      Found in test/test.js and 2 other locations - About 1 hr to fix
      test/test.js on lines 1662..1666
      test/test.js on lines 2186..2190

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

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

      var read = function( filepath ) {
          // if user passes in a glob, we forEach over them
          // and pass it into read() as filepath
          var path = filepath || this.state.path
      
      
      Severity: Minor
      Found in src/core/read.js - About 1 hr to fix

        Function semicolons has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        var semicolons = function( line ) {
            if ( ignoreRe.test( line.trim() ) ) return
            if ( this.state.hashOrCss ) return
        
            var semicolon
        Severity: Minor
        Found in src/checks/semicolons.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 efficient has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var efficient = function( line ) {
            // line doesnt have margin or padding then there's nothin to do here
            if ( !valueRe.test( line ) ) { return }
        
            var isEfficient = true
        Severity: Minor
        Found in src/checks/efficient.js - About 1 hr to fix

          Function quotePref has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var quotePref = function( line, origLine ) {
              if ( origLine.indexOf( '"' ) === -1 &&
                      origLine.indexOf( "'" ) === -1 ) {
                  return
              }
          Severity: Minor
          Found in src/checks/quotePref.js - About 1 hr to fix

            Function colons has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            var colons = function( line ) {
                if ( ignoreRe.test( line ) || this.state.context === 0 ) { return }
            
                var colon
                var hasPseudo = false
            Severity: Minor
            Found in src/checks/colons.js - About 55 mins 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

            Avoid deeply nested control flow statements.
            Open

                            if ( arr[0].indexOf( '-' ) !== -1 ||
                                arr[0].indexOf( '_' ) === -1 ||
                                upperRe.test( arr[0] ) ) {
                                badConvention = true
                            }
            Severity: Major
            Found in src/checks/namingConvention.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          else if ( this.state.conf === 'lowercase-dash' ) {
                              // if no - present, or _ present, or A-Z present
                              if ( arr[0].indexOf( '-' ) === -1 ||
                                  arr[0].indexOf( '_' ) !== -1 ||
                                  upperRe.test( arr[0] ) ) {
              Severity: Major
              Found in src/checks/namingConvention.js - About 45 mins to fix

                Function getExitCode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function getExitCode( errsLength, warningsLength, maxErrors, maxWarnings ) {
                    if ( errsLength > 0 ) {
                        if ( typeof maxErrors === 'number' ) {
                            if ( errsLength > maxErrors ) return 1
                        }
                Severity: Minor
                Found in src/core/done.js - About 45 mins 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 mixed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                var mixed = function( line, origLine ) {
                    var trimRight = origLine.replace( trimRightRe, '' )
                    var isMixed = false
                    var indentPref = this.config.indentPref.expect || this.config.indentPref
                    var isNum = typeof indentPref === 'number'
                Severity: Minor
                Found in src/checks/mixed.js - About 45 mins 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

                var checkPrefix = function( prop, css, valid ) {
                    return valid.prefixes.some( function( prefix ) {
                        return prop === prefix + css
                    } )
                }
                Severity: Minor
                Found in src/utils/checkPrefix.js and 1 other location - About 40 mins to fix
                src/utils/checkPseudo.js on lines 10..14

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

                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