SimenB/stylint

View on GitHub

Showing 48 of 133 total issues

File test.js has 1910 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-env mocha */
/* eslint-disable no-undefined */

'use strict'

Severity: Major
Found in test/test.js - About 5 days to fix

    Function namingConvention has a Cognitive Complexity of 34 (exceeds 5 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 5 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 setConfig has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    var setConfig = function( configpath ) {
        var files = []
        var customPath = ''
        // return default config if nothing passed in or found
        var returnConfig
    Severity: Minor
    Found in src/utils/setConfig.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 brackets has a Cognitive Complexity of 23 (exceeds 5 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 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 lint has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    var lint = function() {
        var method = ''
        var checks = Object.getPrototypeOf( this ).lintMethods
        var maxErrs = typeof this.config.maxErrors === 'number' ? this.config.maxErrors : false
        var maxWarnings = typeof this.config.maxWarnings === 'number' ? this.config.maxWarnings : false
    Severity: Minor
    Found in src/core/lint.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 setConfig has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var setConfig = function( configpath ) {
        var files = []
        var customPath = ''
        // return default config if nothing passed in or found
        var returnConfig
    Severity: Major
    Found in src/utils/setConfig.js - About 2 hrs to fix

      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

        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

          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

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

              var done = function() {
                  var warningsOrErrors = []
                  var msg = ''
                  var groupedByFile = {}
                  var msgGrouped
              Severity: Minor
              Found in src/core/done.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 reporter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              var reporter = function( msg, done, kill ) {
                  if ( done === 'done' ) {
                      // total errors
                      this.cache.msg = 'Stylint: ' + this.cache.errs.length + ' Errors.'
                      this.cache.msg += this.config.maxErrors ? ' (Max Errors: ' + this.config.maxErrors + ')' : ''
              Severity: Minor
              Found in src/core/reporter.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 duplicates has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var duplicates = function( line ) {
                  var arr = this.splitAndStrip( new RegExp( /[\s\t]/ ), line )
                  var dupe = false
                  var dupeIndex
                  var origFile
              Severity: Minor
              Found in src/checks/duplicates.js - About 1 hr to fix

                Function sortOrder has a Cognitive Complexity of 13 (exceeds 5 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: Minor
                Found in src/checks/sortOrder.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 quotePref has a Cognitive Complexity of 13 (exceeds 5 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

                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 Stylint has 39 lines of code (exceeds 25 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 1 hr to fix

                  Function valid has 39 lines of code (exceeds 25 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
                    Severity
                    Category
                    Status
                    Source
                    Language