betajs/betajs-browser

View on GitHub

Showing 83 of 83 total issues

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

        triggerDomEvent: function(element, eventName, parameters, customEventParams) {
            element = this.unbox(element);
            eventName = eventName.toLowerCase();
            var onEvent = "on" + eventName;
            var onEventHandler = null;
Severity: Minor
Found in src/dom/dom.js - About 1 hr to fix

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

            selectionStartOffset: function() {
                if (window.getSelection)
                    return window.getSelection().getRangeAt(0).startOffset;
                else if (document.selection)
                    return document.selection.createRange().startOffset;
    Severity: Major
    Found in src/dom/selection.js and 4 other locations - About 1 hr to fix
    src/dom/selection.js on lines 47..53
    src/dom/selection.js on lines 89..95
    src/dom/selection.js on lines 107..113
    src/dom/selection.js on lines 116..122

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

    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

                xdomreq.onerror = function() {
                    AjaxSupport.promiseRequestException(promise, HttpHeader.HTTP_STATUS_BAD_REQUEST, HttpHeader.format(HttpHeader.HTTP_STATUS_BAD_REQUEST), null, "json"); //options.decodeType);)
                    delete Module.__requests[Ids.objectId(xdomreq)];
                };
    Severity: Major
    Found in src/ajax/xdomain_request_ajax.js and 1 other location - About 1 hr to fix
    src/ajax/xdomain_request_ajax.js on lines 46..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 72.

    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 5 locations. Consider refactoring.
    Open

            selectionEnd: function() {
                if (window.getSelection)
                    return window.getSelection().getRangeAt(0).endContainer;
                else if (document.selection)
                    return document.selection.createRange().endContainer;
    Severity: Major
    Found in src/dom/selection.js and 4 other locations - About 1 hr to fix
    src/dom/selection.js on lines 38..44
    src/dom/selection.js on lines 47..53
    src/dom/selection.js on lines 89..95
    src/dom/selection.js on lines 107..113

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

    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 5 locations. Consider refactoring.
    Open

            selectionEndOffset: function() {
                if (window.getSelection)
                    return window.getSelection().getRangeAt(0).endOffset;
                else if (document.selection)
                    return document.selection.createRange().endOffset;
    Severity: Major
    Found in src/dom/selection.js and 4 other locations - About 1 hr to fix
    src/dom/selection.js on lines 38..44
    src/dom/selection.js on lines 89..95
    src/dom/selection.js on lines 107..113
    src/dom/selection.js on lines 116..122

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

    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 5 locations. Consider refactoring.
    Open

            selectionStart: function() {
                if (window.getSelection)
                    return window.getSelection().getRangeAt(0).startContainer;
                else if (document.selection)
                    return document.selection.createRange().startContainer;
    Severity: Major
    Found in src/dom/selection.js and 4 other locations - About 1 hr to fix
    src/dom/selection.js on lines 38..44
    src/dom/selection.js on lines 47..53
    src/dom/selection.js on lines 89..95
    src/dom/selection.js on lines 116..122

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

    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 5 locations. Consider refactoring.
    Open

            selectionStartNode: function() {
                if (window.getSelection)
                    return window.getSelection().getRangeAt(0).startContainer;
                else if (document.selection)
                    return document.selection.createRange().startContainer;
    Severity: Major
    Found in src/dom/selection.js and 4 other locations - About 1 hr to fix
    src/dom/selection.js on lines 38..44
    src/dom/selection.js on lines 47..53
    src/dom/selection.js on lines 107..113
    src/dom/selection.js on lines 116..122

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

    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

                xdomreq.ontimeout = function() {
                    AjaxSupport.promiseRequestException(promise, HttpHeader.HTTP_STATUS_GATEWAY_TIMEOUT, HttpHeader.format(HttpHeader.HTTP_STATUS_GATEWAY_TIMEOUT), null, "json"); //options.decodeType);)
                    delete Module.__requests[Ids.objectId(xdomreq)];
                };
    Severity: Major
    Found in src/ajax/xdomain_request_ajax.js and 1 other location - About 1 hr to fix
    src/ajax/xdomain_request_ajax.js on lines 51..54

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

    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

        gruntHelper.config.shell["cordova-test-run-ios"] = {
                command: [
                    "cordova run ios --device"
                ].join("&&"),
                options: {
    Severity: Major
    Found in Gruntfile.js and 1 other location - About 1 hr to fix
    Gruntfile.js on lines 111..123

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

    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

        gruntHelper.config.shell["cordova-test-run-android"] = {
                command: [
                    "cordova run android --device"
                ].join("&&"),
                options: {
    Severity: Major
    Found in Gruntfile.js and 1 other location - About 1 hr to fix
    Gruntfile.js on lines 98..110

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

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

                _upload: function() {
                    var file = this._options.isBlob ? this._options.source : this._options.source.files[0];
                    if (!S3Support.validateFileSize(file.size)) {
                        this._setState("error", "File size is too big");
                        return;
    Severity: Minor
    Found in src/uploads/s3/multipart_file_uploader.js - About 1 hr to fix

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

              firefoxVersion: function() {
                  return this.__cached("firefoxVersion", function(nav, ua) {
                      var re = /Firefox\/(\d+\.\d+)/gi;
                      var ma = re.exec(ua);
                      if (ma)
      Severity: Major
      Found in src/browser/info.js and 3 other locations - About 1 hr to fix
      src/browser/info.js on lines 272..280
      src/browser/info.js on lines 282..290
      src/browser/info.js on lines 292..300

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

      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

              isMacOS: function() {
                  return this.__cached("isMacOS", function(nav) {
                      return !this.isiOS() && nav.appVersion.toLowerCase().indexOf("mac") != -1;
                  });
              },
      Severity: Major
      Found in src/browser/info.js and 1 other location - About 1 hr to fix
      src/browser/info.js on lines 225..229

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

      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

              isLinux: function() {
                  return this.__cached("isLinux", function(nav) {
                      return !this.isAndroid() && nav.appVersion.toLowerCase().indexOf("linux") != -1;
                  });
              },
      Severity: Major
      Found in src/browser/info.js and 1 other location - About 1 hr to fix
      src/browser/info.js on lines 213..217

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

      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 4 locations. Consider refactoring.
      Open

              chromeVersion: function() {
                  return this.__cached("chromeVersion", function(nav, ua) {
                      var re = /(Chrome|CriOS)\/(\d+\.\d+)[^\d]/gi;
                      var ma = re.exec(ua);
                      if (ma)
      Severity: Major
      Found in src/browser/info.js and 3 other locations - About 1 hr to fix
      src/browser/info.js on lines 282..290
      src/browser/info.js on lines 292..300
      src/browser/info.js on lines 302..310

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

      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 4 locations. Consider refactoring.
      Open

              operaVersion: function() {
                  return this.__cached("operaVersion", function(nav, ua) {
                      var re = /OPR\/(\d+\.\d+)[^\d]/gi;
                      var ma = re.exec(ua);
                      if (ma)
      Severity: Major
      Found in src/browser/info.js and 3 other locations - About 1 hr to fix
      src/browser/info.js on lines 272..280
      src/browser/info.js on lines 292..300
      src/browser/info.js on lines 302..310

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

      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 4 locations. Consider refactoring.
      Open

              safariVersion: function() {
                  return this.__cached("safariVersion", function(nav, ua) {
                      var re = /Version\/(\d+\.\d+)[^\d]/gi;
                      var ma = re.exec(ua);
                      if (ma)
      Severity: Major
      Found in src/browser/info.js and 3 other locations - About 1 hr to fix
      src/browser/info.js on lines 272..280
      src/browser/info.js on lines 282..290
      src/browser/info.js on lines 302..310

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

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

              elementDimensions: function(element) {
                  element = this.unbox(element);
                  var cs, w, h;
                  if (element && window.getComputedStyle) {
                      try {
      Severity: Minor
      Found in src/dom/dom.js - About 1 hr to fix

        Function _upload has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    _upload: function() {
                        var identifier = this.__generateIdentifier();
                        var file = this._options.isBlob ? this._options.source : this._options.source.files[0];
                        Blobs.loadFileIntoArrayBuffer(file).success(function(arrayBuffer) {
                            var chunkNumber = 0;
        Severity: Minor
        Found in src/uploads/chunked_file_uploader.js - About 1 hr to fix

          Function _updateState has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      _updateState: function() {
                          if (this.state() !== "uploading")
                              return;
                          this._uploadingCount = 0;
                          var error = false;
          Severity: Minor
          Found in src/uploads/multi_uploader.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language