benjamine/resource-shadow

View on GitHub

Showing 88 of 160 total issues

Function objEquiv has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function objEquiv (a, b) {
    if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
      return false;
    // an identical "prototype" property.
    if (a.prototype !== b.prototype) return false;
Severity: Minor
Found in public/build/test-bundle.js - About 1 hr to fix

    Function 8 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    },{"expect.js":2}],8:[function(require,module,exports){
    
    function MockHttpHandler() {
      this.resources = {};
      this.latency = 2;
    Severity: Minor
    Found in public/build/test-bundle.js - About 1 hr to fix

      Function uint8ToBase64 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function uint8ToBase64 (uint8) {
              var i,
                  extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
                  output = "",
                  temp, length
      Severity: Minor
      Found in public/build/test-bundle.js - About 1 hr to fix

        Function keys has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Assertion.prototype.keys = function ($keys) {
            var str
              , ok = true;
        
            $keys = isArray($keys)
        Severity: Minor
        Found in public/build/test-bundle.js - About 1 hr to fix

          Function slice has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Buffer.prototype.slice = function (start, end) {
            var len = this.length
            start = ~~start
            end = end === undefined ? len : ~~end
          
          
          Severity: Minor
          Found in public/build/test-bundle.js - About 1 hr to fix

            Function reduce has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function reduce (arr, fun) {
                if (Array.prototype.reduce) {
                  return Array.prototype.reduce.apply(
                      arr
                    , Array.prototype.slice.call(arguments, 1)
            Severity: Minor
            Found in public/build/test-bundle.js - About 1 hr to fix

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

              },{}],9:[function(require,module,exports){
              
              function MockLocalStorage() {
                this.values = {};
                this.listeners = {};
              Severity: Minor
              Found in public/build/test-bundle.js - About 1 hr to fix

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

                ResourceShadow.prototype.save = function() {
                  if (this.loading || this.saving) {
                    // changes will be detected at the end of current process
                    return;
                  }
                Severity: Minor
                Found in public/build/resource-shadow.js - About 1 hr to fix

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

                  ResourceShadow.prototype.save = function() {
                    if (this.loading || this.saving) {
                      // changes will be detected at the end of current process
                      return;
                    }
                  Severity: Minor
                  Found in src/resource-shadow.js - About 1 hr to fix

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

                    process.nextTick = (function () {
                        var canSetImmediate = typeof window !== 'undefined'
                        && window.setImmediate;
                        var canPost = typeof window !== 'undefined'
                        && window.postMessage && window.addEventListener
                    Severity: Minor
                    Found in public/build/resource-shadow.js - About 1 hr to fix

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

                      Buffer.byteLength = function (str, encoding) {
                        var ret
                        str = str + ''
                        switch (encoding || 'utf8') {
                          case 'ascii':
                      Severity: Minor
                      Found in public/build/test-bundle.js - About 1 hr to fix

                        Function b64ToByteArray has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function b64ToByteArray (b64) {
                                var i, j, l, tmp, placeHolders, arr
                        
                                if (b64.length % 4 > 0) {
                                    throw new Error('Invalid string. Length must be a multiple of 4')
                        Severity: Minor
                        Found in public/build/test-bundle.js - About 1 hr to fix

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

                          exports.read = function(buffer, offset, isLE, mLen, nBytes) {
                            var e, m,
                                eLen = nBytes * 8 - mLen - 1,
                                eMax = (1 << eLen) - 1,
                                eBias = eMax >> 1,
                          Severity: Minor
                          Found in public/build/test-bundle.js - About 1 hr to fix

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

                              Assertion.prototype.throwException = function (fn) {
                                expect(this.obj).to.be.a('function');
                            
                                var thrown = false
                                  , not = this.flags.not;
                            Severity: Minor
                            Found in public/build/test-bundle.js - About 1 hr to fix

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

                              },{}],7:[function(require,module,exports){
                              (function (global){
                              
                              global.when = function(){
                                var args = Array.prototype.slice.apply(arguments);
                              Severity: Minor
                              Found in public/build/test-bundle.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

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

                              ResourceShadow.prototype.setLocalStorageValue = function(data) {
                                var json;
                                if (data === null || typeof data === 'undefined') {
                                  json = null;
                                } else {
                              Severity: Minor
                              Found in src/resource-shadow.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 checkIEEE754 has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function checkIEEE754 (buf, value, offset, ext, max, min) {
                              Severity: Minor
                              Found in public/build/test-bundle.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if (v) {
                                                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                        }
                                Severity: Major
                                Found in public/build/test-bundle.js - About 45 mins to fix

                                  Function checkInt has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  function checkInt (buf, value, offset, ext, max, min) {
                                  Severity: Minor
                                  Found in public/build/test-bundle.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if (v) {
                                                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                            }
                                    Severity: Major
                                    Found in public/build/test-bundle.js - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language