SimenB/stylint

View on GitHub

Showing 133 of 133 total issues

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

        it( 'space: false if global dupe off and file changed', function() {
            dupeTest( '    .test4' ) // to set the context
            app.cache.prevFile = 'file.styl'
            app.cache.file = 'file2.styl'
            app.config.globalDupe = false
Severity: Major
Found in test/test.js and 1 other location - About 2 hrs to fix
test/test.js on lines 957..963

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

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 efficient has a Cognitive Complexity of 18 (exceeds 5 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 2 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 sortOrder has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var sortOrder = function( line ) {
    // we don't alphabetize the root yet
    if ( this.state.context === 0 || this.state.hash ) {
        this.cache.sortOrderCache = []
        return
Severity: Major
Found in src/checks/sortOrder.js - About 2 hrs to fix

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

            it( 'false (no err) if outline none', function() {
                assert.ok( !noneTest( 'outline none' ) )
                assert.ok( !noneTest( 'outline: none' ) )
                assert.ok( !noneTest( 'outline:none' ) )
                assert.ok( !noneTest( 'outline 1px solid red' ) )
    Severity: Major
    Found in test/test.js and 1 other location - About 2 hrs to fix
    test/test.js on lines 1642..1647

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

    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

            it( 'false (no err) if border none', function() {
                assert.ok( !noneTest( 'border none' ) )
                assert.ok( !noneTest( 'border: none' ) )
                assert.ok( !noneTest( 'border:none' ) )
                assert.ok( !noneTest( 'border 1px solid red' ) )
    Severity: Major
    Found in test/test.js and 1 other location - About 2 hrs to fix
    test/test.js on lines 1649..1654

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

    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 ( this.state.conf === 'double' && match[0].indexOf( "'" ) === 0 ) {
                // "" is allowed when it's cases like "Someone's string here"
                hasInnerQuote = content.indexOf( '"' ) !== -1
    
                if ( !hasInnerQuote ) {
    Severity: Major
    Found in src/checks/quotePref.js and 1 other location - About 2 hrs to fix
    src/checks/quotePref.js on lines 31..39

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

    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 ( this.state.conf === 'single' && match[0].indexOf( '"' ) === 0 ) {
                // "" is allowed when it's cases like "Someone's string here"
                hasInnerQuote = content.indexOf( "'" ) !== -1
    
                if ( !hasInnerQuote ) {
    Severity: Major
    Found in src/checks/quotePref.js and 1 other location - About 2 hrs to fix
    src/checks/quotePref.js on lines 41..49

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

    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 ( this.state.conf === 'lowercase_underscore' ) {
                    // 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 and 1 other location - About 2 hrs to fix
    src/checks/namingConvention.js on lines 55..77

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

    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 ( 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 and 1 other location - About 2 hrs to fix
    src/checks/namingConvention.js on lines 46..77

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

    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

            it( 'false if no bracket found', function() {
                assert.equal( false, bracketsTest( '.class-name' ) )
                assert.equal( false, bracketsTest( '#id' ) )
                assert.equal( false, bracketsTest( 'body.main' ) )
                assert.equal( false, bracketsTest( '+ span' ) )
    Severity: Major
    Found in test/test.js and 1 other location - About 2 hrs to fix
    test/test.js on lines 1191..1196

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

    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

            it( 'false if hash start not found', function() {
                assert.equal( false, hashTest( '$myconst =' ) )
                assert.equal( false, hashTest( 'myconst = @block' ) )
                assert.equal( false, hashTest( '.mistakenUseOfBracket {' ) )
                assert.equal( false, hashTest( 'margin 0' ) )
    Severity: Major
    Found in test/test.js and 1 other location - About 2 hrs to fix
    test/test.js on lines 551..556

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

    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 Stylint has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    var Stylint = function( path, config, callback ) {
        return stampit().compose(
            require( './src/core/' ),
            require( './src/checks/' ),
            require( './src/state/' ),
    Severity: Minor
    Found in index.js - About 2 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 done has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var done = function() {
        var warningsOrErrors = []
        var msg = ''
        var groupedByFile = {}
        var msgGrouped
    Severity: Minor
    Found in src/core/done.js - About 2 hrs to fix

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

          if ( !isValid ) {
              isValid = validJSON.css.some( function( css ) {
                  return arr[0] === css || this.checkPrefix( arr[0], css, validJSON )
              }.bind( this ) )
          }
      Severity: Major
      Found in src/checks/valid.js and 1 other location - About 2 hrs to fix
      src/checks/valid.js on lines 62..66

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

      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

              it( 'undefined if in keyframes', function() {
                  app.state.keyframes = true
                  assert.equal( undefined, zeroTest( 'from 0%' ) )
                  assert.equal( undefined, zeroTest( '0% {' ) )
                  app.state.keyframes = false
      Severity: Major
      Found in test/test.js and 1 other location - About 2 hrs to fix
      test/test.js on lines 2324..2329

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

      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 ( !isValid ) {
              isValid = validJSON.html.some( function( html ) {
                  return arr[0] === html || this.checkPseudo( arr[0], html, validJSON )
              }.bind( this ) )
          }
      Severity: Major
      Found in src/checks/valid.js and 1 other location - About 2 hrs to fix
      src/checks/valid.js on lines 55..59

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

      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

              it( 'undefined if in keyframes', function() {
                  app.state.keyframes = true
                  assert.equal( undefined, zeroTest( 'from 0%' ) )
                  assert.equal( undefined, zeroTest( '0% {' ) )
                  app.state.keyframes = false
      Severity: Major
      Found in test/test.js and 1 other location - About 2 hrs to fix
      test/test.js on lines 2377..2382

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

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

      var brackets = function( line ) {
          // in order if:
          // 1 in hash or css block
          // 2 variable or hash or block
          // 3 mixin
      Severity: Minor
      Found in src/checks/brackets.js - About 2 hrs to fix

        Function namingConvention has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var namingConvention = function( line ) {
            var arr = this.splitAndStrip( ' ', line )
            // determine if line should be tested at all
            var doWeTestRe = /^[${:]+/m
            var badConvention = false
        Severity: Minor
        Found in src/checks/namingConvention.js - About 1 hr to fix

          Function setState has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          var setState = function( line ) {
              this.state.context = this.setContext( this.cache.line )
          
              // ignore the current line if @stylint ignore
              if ( this.cache.origLine.indexOf( '@stylint ignore' ) !== -1 ) {
          Severity: Minor
          Found in src/core/setState.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