rootslab/hoar

View on GitHub

Showing 27 of 35 total issues

Function Hoar has a Cognitive Complexity of 177 (exceeds 5 allowed). Consider refactoring.
Open

exports.Hoar = ( function () {
    var log = console.log
        , isArray = Array.isArray
        , alpha = /[^a-z0-9]/gi
        , abs = Math.abs
Severity: Minor
Found in lib/hoar.js - About 3 days 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 Hoar has 313 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.Hoar = ( function () {
    var log = console.log
        , isArray = Array.isArray
        , alpha = /[^a-z0-9]/gi
        , abs = Math.abs
Severity: Major
Found in lib/hoar.js - About 1 day to fix

    File hoar.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Hoar, a fast and light semantic versioning parser/comparator.
     *
     * Copyright(c) 2013-present Guglielmo Ferri <44gatti@gmail.com>
     * MIT Licensed
    Severity: Minor
    Found in lib/hoar.js - About 3 hrs to fix

      Function check has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              , check = function ( version1, version2, condition ) {
                  var v1 = version1 || [ NaN, NaN, NaN ]
                      , v2 = version2 || [ NaN, NaN, NaN ]
                      , cond = condition || '='
                      ;
      Severity: Major
      Found in lib/hoar.js - About 3 hrs to fix

        Function checkPre has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                , checkPre = function ( pv, pw, cond ) {
                    var c = cond
                        , pvlen = pv.length
                        , pwlen = pw.length
                        , lmin = min( pvlen, pwlen )
        Severity: Minor
        Found in lib/hoar.js - About 1 hr to fix

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

                  , range : function ( values, vrange, nostrict, verbose ) {
                      var v = isArray( values ) ? values : [ values ]
                          , vlen = v.length
                          , vr = isArray( vrange ) ? vrange : []
                          , r1 = vr[ 0 ] || - Infinity
          Severity: Minor
          Found in lib/hoar.js - About 1 hr to fix

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

                    , print = function ( arr ) {
                        var v = arr[ 0 ]
                            , p = arr[ 1 ]
                            , search = function ( arr, pre ) {
                                var list = isArray( arr ) ? arr : []
            Severity: Minor
            Found in lib/hoar.js - About 1 hr to fix

              Avoid too many return statements within this function.
              Open

                                      return false;
              Severity: Major
              Found in lib/hoar.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                        return true;
                Severity: Major
                Found in lib/hoar.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                          return true;
                  Severity: Major
                  Found in lib/hoar.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                            return false;
                    Severity: Major
                    Found in lib/hoar.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                          return true;
                      Severity: Major
                      Found in lib/hoar.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                                return true;
                        Severity: Major
                        Found in lib/hoar.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                  return false;
                          Severity: Major
                          Found in lib/hoar.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                    return false;
                            Severity: Major
                            Found in lib/hoar.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                                      return false;
                              Severity: Major
                              Found in lib/hoar.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                        return false;
                                Severity: Major
                                Found in lib/hoar.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                                          return false;
                                  Severity: Major
                                  Found in lib/hoar.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                            return true;
                                    Severity: Major
                                    Found in lib/hoar.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                          return true;
                                      Severity: Major
                                      Found in lib/hoar.js - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language