benjamine/resource-shadow

View on GitHub

Showing 88 of 160 total issues

Function 2 has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./resource-shadow":6,"_process":2}],2:[function(require,module,exports){
// shim for using process in browser

var process = module.exports = {};

Severity: Minor
Found in public/build/resource-shadow.js - About 2 hrs to fix

    Function write has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Buffer.prototype.write = function (string, offset, length, encoding) {
      // Support both (string, offset, length, encoding)
      // and the legacy (string, encoding, offset, length)
      if (isFinite(offset)) {
        if (!isFinite(length)) {
    Severity: Minor
    Found in public/build/test-bundle.js - About 2 hrs to fix

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

      },{}],4:[function(require,module,exports){
      
      function HttpHandler() {
      }
      
      
      Severity: Minor
      Found in public/build/resource-shadow.js - About 1 hr to fix

        Function 3 has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        },{}],3:[function(require,module,exports){
        function M() { this._events = {}; }
        M.prototype = {
          on: function(ev, cb) {
            this._events || (this._events = {});
        Severity: Minor
        Found in public/build/resource-shadow.js - About 1 hr to fix

          Function _augment has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Buffer._augment = function (arr) {
            arr.constructor = Buffer
            arr._isBuffer = true
          
            // save reference to original Uint8Array get/set methods before overwriting
          Severity: Minor
          Found in public/build/test-bundle.js - About 1 hr to fix

            Function Buffer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Buffer (subject, encoding, noZero) {
              if (!(this instanceof Buffer))
                return new Buffer(subject, encoding, noZero)
            
              var type = typeof subject
            Severity: Minor
            Found in public/build/test-bundle.js - About 1 hr to fix

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

              ResourceShadow.prototype.mirrorObject = function(source, target) {
                var self = this;
                if (typeof source !== 'object' || source === null || typeof target !== 'object' || target === null) {
                  return false;
                }
              Severity: Minor
              Found in src/resource-shadow.js - About 1 hr to fix

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

                ResourceShadow.prototype.mirrorObject = function(source, target) {
                  var self = this;
                  if (typeof source !== 'object' || typeof target !== 'object') {
                    return false;
                  }
                Severity: Minor
                Found in public/build/resource-shadow.js - About 1 hr to fix

                  Function ajax has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  HttpHandler.prototype.ajax = function(method, url, headers, body, callback) {
                  
                    // simple browser implementation
                    var request = new XMLHttpRequest();
                    request.open(method, url, true);
                  Severity: Minor
                  Found in src/http-handler.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 write has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
                    var e, m, c,
                        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 ajax has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    HttpHandler.prototype.ajax = function(method, url, headers, body, callback) {
                    
                      // simple browser implementation
                      var request = new XMLHttpRequest();
                      request.open(method, url, true);
                    Severity: Minor
                    Found in public/build/resource-shadow.js - About 1 hr to fix

                      Function ajax has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      HttpHandler.prototype.ajax = function(method, url, headers, body, callback) {
                      
                        // simple browser implementation
                        var request = new XMLHttpRequest();
                        request.open(method, url, true);
                      Severity: Minor
                      Found in src/http-handler.js - About 1 hr to fix

                        Function load has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        ResourceShadow.prototype.load = function(preJson) {
                        
                          this.loadLocal();
                        
                          if (this.loading || this.saving) {
                        Severity: Minor
                        Found in src/resource-shadow.js - About 1 hr to fix

                          Function processJsonFromServer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          ResourceShadow.prototype.processJsonFromServer = function(serverJson, preJson) {
                            this.shadow = serverJson;
                            var currentLocalJson = this.localStorage.getItem(this.localKey);
                          
                            if (serverJson !== preJson) {
                          Severity: Minor
                          Found in public/build/resource-shadow.js - About 1 hr to fix

                            Function processJsonFromServer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            ResourceShadow.prototype.processJsonFromServer = function(serverJson, preJson) {
                              this.shadow = serverJson;
                              var currentLocalJson = this.localStorage.getItem(this.localKey);
                            
                              if (serverJson !== preJson) {
                            Severity: Minor
                            Found in src/resource-shadow.js - About 1 hr to fix

                              Function load has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              ResourceShadow.prototype.load = function(preJson) {
                              
                                this.loadLocal();
                              
                                if (this.loading || this.saving) {
                              Severity: Minor
                              Found in public/build/resource-shadow.js - About 1 hr to fix

                                Function parse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    JSON.parse = function (text, reviver) {
                                    // The parse method takes a text and an optional reviver function, and returns
                                    // a JavaScript value if the text is a valid JSON text.
                                
                                        var j;
                                Severity: Minor
                                Found in public/build/test-bundle.js - About 1 hr to fix

                                  Function property has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    Assertion.prototype.property = function (name, val) {
                                      if (this.flags.own) {
                                        this.assert(
                                            Object.prototype.hasOwnProperty.call(this.obj, name)
                                          , function(){ return 'expected ' + i(this.obj) + ' to have own property ' + i(name) }
                                  Severity: Minor
                                  Found in public/build/test-bundle.js - About 1 hr to fix

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

                                      function Assertion (obj, flag, parent) {
                                        this.obj = obj;
                                        this.flags = {};
                                    
                                        if (undefined != parent) {
                                    Severity: Minor
                                    Found in public/build/test-bundle.js - About 1 hr to fix

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

                                      Buffer.prototype.toString = function (encoding, start, end) {
                                        var loweredCase = false
                                      
                                        start = start >>> 0
                                        end = end === undefined || end === Infinity ? this.length : end >>> 0
                                      Severity: Minor
                                      Found in public/build/test-bundle.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language