pinclub/pinclub

View on GitHub
public/libs/webuploader/webuploader.withoutimage.js

Summary

Maintainability
F
1 wk
Test Coverage

File webuploader.withoutimage.js has 2734 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! WebUploader 0.1.5 */


/**
* @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。
Severity: Major
Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 wk to fix

    Function _doSend has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                _doSend: function (block) {
                    var me = this,
                        owner = me.owner,
                        opts = me.options,
                        file = block.file,
    Severity: Major
    Found in public/libs/webuploader/webuploader.withoutimage.js - About 3 hrs to fix

      Function RuntimeClient has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function RuntimeClient(component, standalone) {
                  var deferred = Base.Deferred(),
                      runtime;
      
                  this.uid = Base.guid('client_');
      Severity: Major
      Found in public/libs/webuploader/webuploader.withoutimage.js - About 2 hrs to fix

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

                function FlashRuntime() {
                    var pool = {},
                        clients = {},
                        destory = this.destory,
                        me = this,
        Severity: Minor
        Found in public/libs/webuploader/webuploader.withoutimage.js - About 2 hrs to fix

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

                      init: function () {
                          var container = this.getRuntime().getContainer(),
                              me = this,
                              owner = me.owner,
                              opts = me.options,
          Severity: Minor
          Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                        send: function () {
                            var owner = this.owner,
                                opts = this.options,
                                xhr = this._initAjax(),
                                blob = owner._blob,
            Severity: Minor
            Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                          _onFileStatusChange: function (curStatus, preStatus) {
                              var stats = this.stats;
              
                              switch (preStatus) {
                                  case STATUS.PROGRESS:
              Severity: Minor
              Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                            request: function (apiName, args, callback) {
                                var i = 0,
                                    widgets = this._widgets,
                                    len = widgets.length,
                                    rlts = [],
                Severity: Minor
                Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                              _initAjax: function () {
                                  var me = this,
                                      xhr = new RuntimeClient('XMLHttpRequest');
                  
                                  xhr.on('uploadprogress progress', function (e) {
                  Severity: Minor
                  Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                                _initAjax: function () {
                                    var me = this,
                                        xhr = new XMLHttpRequest(),
                                        opts = this.options;
                    
                    
                    Severity: Minor
                    Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                                  init: function () {
                                      var me = this,
                                          opts = me.options,
                                          button = opts.button;
                      
                      
                      Severity: Minor
                      Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                                    init: function (opts) {
                                        var me = this,
                                            deferred, len, i, item, arr, accept, runtime;
                        
                                        if ($.isPlainObject(opts.accept)) {
                        Severity: Minor
                        Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                                  function CuteFile(file, chunkSize) {
                                      var pending = [],
                                          blob = file.source,
                                          total = blob.size,
                                          chunks = chunkSize ? Math.ceil(total / chunkSize) : 1,
                          Severity: Minor
                          Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                                        _startSend: function (block) {
                                            var me = this,
                                                file = block.file,
                                                promise;
                            
                            
                            Severity: Minor
                            Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                                          addButton: function (pick) {
                                              var me = this,
                                                  opts = me.options,
                                                  accept = opts.accept,
                                                  promises = [];
                              Severity: Minor
                              Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

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

                                            _nextBlock: function () {
                                                var me = this,
                                                    act = me._act,
                                                    opts = me.options,
                                                    next, done;
                                Severity: Minor
                                Found in public/libs/webuploader/webuploader.withoutimage.js - About 1 hr to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                                  if (
                                                  // 调用通过on方法注册的handler.
                                                          Mediator.trigger.apply(this, arguments) === false ||
                                  
                                                  // 调用opts.onEvent
                                  Severity: Major
                                  Found in public/libs/webuploader/webuploader.withoutimage.js - About 40 mins to fix

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

                                                init: function (opts) {
                                    
                                                    if (!opts.paste ||
                                                            this.request('predict-runtime-type') !== 'html5') {
                                                        return;
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 6 hrs to fix
                                    public/libs/jquery-2.1.0.js on lines 5619..5637

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

                                    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

                                                        for (i = 0, len = opts.accept.length; i < len; i++) {
                                                            item = opts.accept[i].mimeTypes;
                                                            item && arr.push(item);
                                                        }
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 1 hr to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 2319..2322

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

                                    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

                                                        for (i = 0, len = opts.accept.length; i < len; i++) {
                                                            item = opts.accept[i].extensions;
                                                            item && arr.push(item);
                                                        }
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 1 hr to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 3979..3982

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

                                    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

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                                init: function () {
                                                    var me = this;
                                    
                                                    me.connectRuntime(me.options, function () {
                                                        me.exec('init');
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 1 hr to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 1177..1184

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

                                    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

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                                init: function () {
                                                    var me = this;
                                    
                                                    me.connectRuntime(me.options, function () {
                                                        me.exec('init');
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 1 hr to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 1453..1460

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

                                    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

                                                setRequestHeader: function (key, value) {
                                                    if (typeof key === 'object') {
                                                        $.extend(this._headers, key);
                                                    } else {
                                                        this._headers[key] = value;
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 1 hr to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 2687..2693

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

                                    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

                                                append: function (key, value) {
                                                    if (typeof key === 'object') {
                                                        $.extend(this._formData, key);
                                                    } else {
                                                        this._formData[key] = value;
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 1 hr to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 2695..2701

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

                                    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

                                                    if (this.options.disableGlobalDnd) {
                                                        $(document).on('dragover', this.dragOverHandler);
                                                        $(document).on('drop', this.dropHandler);
                                                    }
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 1 hr to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 3951..3954

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

                                    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

                                                    if (this.options.disableGlobalDnd) {
                                                        $(document).off('dragover', this.dragOverHandler);
                                                        $(document).off('drop', this.dropHandler);
                                                    }
                                    Severity: Major
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 1 hr to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 3782..3785

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

                                    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

                                                        if (rlt !== IGNORE) {
                                    
                                                            // Deferred对象
                                                            if (Base.isPromise(rlt)) {
                                                                dfds.push(rlt);
                                    Severity: Minor
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 35 mins to fix
                                    public/libs/jquery-2.1.0.js on lines 7185..7192

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

                                    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

                                                    if (invalid && flag) {
                                                        flag = false;
                                                        this.trigger('error', 'Q_EXCEED_SIZE_LIMIT', max, file);
                                                        setTimeout(function () {
                                                            flag = true;
                                    Severity: Minor
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 30 mins to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 3484..3490

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

                                    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

                                                    if (count >= max && flag) {
                                                        flag = false;
                                                        this.trigger('error', 'Q_EXCEED_NUM_LIMIT', max, file);
                                                        setTimeout(function () {
                                                            flag = true;
                                    Severity: Minor
                                    Found in public/libs/webuploader/webuploader.withoutimage.js and 1 other location - About 30 mins to fix
                                    public/libs/webuploader/webuploader.withoutimage.js on lines 3529..3535

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status