qcminecraft/Carbon-Forum-F

View on GitHub
static/editor/dialogs/attachment/attachment.js

Summary

Maintainability
F
3 wks
Test Coverage

Function initUploader has 359 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        initUploader: function () {
            var _this = this,
                $ = jQuery,    // just in case. Make sure it's not an other libaray.
                $wrap = _this.$wrap,
            // 图片容器
Severity: Major
Found in static/editor/dialogs/attachment/attachment.js - About 1 day to fix

    File attachment.js has 625 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * User: Jinqn
     * Date: 14-04-08
     * Time: 下午16:34
     * 上传图片对话框逻辑代码,包括tab: 远程图片/上传图片/在线图片/搜索图片
    Severity: Major
    Found in static/editor/dialogs/attachment/attachment.js - About 1 day to fix

      Function addFile has 117 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function addFile(file) {
                      var $li = $('<li id="' + file.id + '">' +
                              '<p class="title">' + file.name + '</p>' +
                              '<p class="imgWrap"></p>' +
                              '<p class="progress"><span></span></p>' +
      Severity: Major
      Found in static/editor/dialogs/attachment/attachment.js - About 4 hrs to fix

        Function setState has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    function setState(val, files) {
        
                        if (val != state) {
        
                            var stats = uploader.getStats();
        Severity: Major
        Found in static/editor/dialogs/attachment/attachment.js - About 2 hrs to fix

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

                  pushData: function (list) {
                      var i, item, img, filetype, preview, icon, _this = this,
                          urlPrefix = editor.getOpt('fileManagerUrlPrefix');
                      for (i = 0; i < list.length; i++) {
                          if(list[i] && list[i].url) {
          Severity: Minor
          Found in static/editor/dialogs/attachment/attachment.js - About 1 hr to fix

            Function getFileData has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    getFileData: function () {
                        var _this = this;
            
                        if(!_this.listEnd && !this.isLoadingData) {
                            this.isLoadingData = true;
            Severity: Minor
            Found in static/editor/dialogs/attachment/attachment.js - About 1 hr to fix

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

                          function setState(val, files) {
              
                              if (val != state) {
              
                                  var stats = uploader.getStats();
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 3 days to fix
              static/editor/dialogs/image/image.js on lines 556..630
              static/editor/dialogs/video/video.js on lines 567..641

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

              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

                          var _this = this,
                              $ = jQuery,    // just in case. Make sure it's not an other libaray.
                              $wrap = _this.$wrap,
                          // 图片容器
                              $queue = $wrap.find('.filelist'),
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 2 days to fix
              static/editor/dialogs/video/video.js on lines 328..374

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

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

                      scale: function (img, w, h, type) {
                          var ow = img.width,
                              oh = img.height;
              
                          if (type == 'justify') {
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 2 days to fix
              static/editor/dialogs/background/background.js on lines 324..349
              static/editor/dialogs/image/image.js on lines 922..947

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

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

                              var $li = $('<li id="' + file.id + '">' +
                                      '<p class="title">' + file.name + '</p>' +
                                      '<p class="imgWrap"></p>' +
                                      '<p class="progress"><span></span></p>' +
                                      '</li>'),
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 1 day to fix
              static/editor/dialogs/image/image.js on lines 402..435
              static/editor/dialogs/video/video.js on lines 408..441

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

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

                              file.on('statuschange', function (cur, prev) {
                                  if (prev === 'progress') {
                                      $prgress.hide().width(0);
                                  } else if (prev === 'queued') {
                                      $li.off('mouseenter mouseleave');
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 1 day to fix
              static/editor/dialogs/image/image.js on lines 466..488
              static/editor/dialogs/video/video.js on lines 477..499

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

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

                          function updateStatus() {
                              var text = '', stats;
              
                              if (state === 'ready') {
                                  text = lang.updateStatusReady.replace('_', fileCount).replace('_KB', WebUploader.formatSize(fileSize));
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 1 day to fix
              static/editor/dialogs/image/image.js on lines 632..654
              static/editor/dialogs/video/video.js on lines 643..665

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

              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

                      initEvents: function () {
                          var _this = this;
              
                          /* 滚动拉取图片 */
                          domUtils.on($G('fileList'), 'scroll', function(e){
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 1 day to fix
              static/editor/dialogs/image/image.js on lines 811..834

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

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

                              $btns.on('click', 'span', function () {
                                  var index = $(this).index(),
                                      deg;
              
                                  switch (index) {
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 1 day to fix
              static/editor/dialogs/image/image.js on lines 497..525
              static/editor/dialogs/video/video.js on lines 508..536

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

              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

                          uploader.on('uploadSuccess', function (file, ret) {
                              var $file = $('#' + file.id);
                              try {
                                  var responseText = (ret._raw || ret),
                                      json = utils.str2json(responseText);
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 7 hrs to fix
              static/editor/dialogs/image/image.js on lines 715..729

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

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

                          function updateTotalProgress() {
                              var loaded = 0,
                                  total = 0,
                                  spans = $progress.children(),
                                  percent;
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 7 hrs to fix
              static/editor/dialogs/image/image.js on lines 538..554
              static/editor/dialogs/video/video.js on lines 549..565

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

              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

                                      if (browser.ie && browser.version <= 7) {
                                          $wrap.text(lang.uploadNoPreview);
                                      } else {
                                          uploader.makeThumb(file, function (error, src) {
                                              if (error || !src) {
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 6 hrs to fix
              static/editor/dialogs/image/image.js on lines 441..455

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

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

                          uploader.on('all', function (type, files) {
                              switch (type) {
                                  case 'uploadFinished':
                                      setState('confirm', files);
                                      break;
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 5 hrs to fix
              static/editor/dialogs/image/image.js on lines 683..699
              static/editor/dialogs/video/video.js on lines 694..710

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

              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

                      initContainer: function () {
                          this.container.innerHTML = '';
                          this.list = document.createElement('ul');
                          this.clearFloat = document.createElement('li');
              
              
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 5 hrs to fix
              static/editor/dialogs/image/image.js on lines 799..809

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

              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

                      for (i = 0; i < tabs.length; i++) {
                          bodyId = tabs[i].getAttribute('data-content-id')
                          if (bodyId == id) {
                              domUtils.addClass(tabs[i], 'focus');
                              domUtils.addClass($G(bodyId), 'focus');
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 4 hrs to fix
              static/editor/dialogs/image/image.js on lines 43..52

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

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

                          if (!WebUploader.Uploader.support()) {
                              $('#filePickerReady').after($('<div>').html(lang.errorNotSupport)).hide();
                              return;
                          } else if (!editor.getOpt('fileActionName')) {
                              $('#filePickerReady').after($('<div>').html(lang.errorLoadConfig)).hide();
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 4 hrs to fix
              static/editor/dialogs/image/image.js on lines 354..360
              static/editor/dialogs/video/video.js on lines 376..382

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

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

                      getQueueCount: function () {
                          var file, i, status, readyFile = 0, files = this.uploader.getFiles();
                          for (i = 0; file = files[i++]; ) {
                              status = file.getStatus();
                              if (status == 'queued' || status == 'uploading' || status == 'progress') readyFile++;
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 3 hrs to fix
              static/editor/dialogs/image/image.js on lines 758..765
              static/editor/dialogs/video/video.js on lines 773..780

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

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

                          $upload.on('click', function () {
                              if ($(this).hasClass('disabled')) {
                                  return false;
                              }
              
              
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 3 hrs to fix
              static/editor/dialogs/image/image.js on lines 741..753
              static/editor/dialogs/video/video.js on lines 756..768

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

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

                          uploader.on('uploadProgress', function (file, percentage) {
                              var $li = $('#' + file.id),
                                  $percent = $li.find('.progress span');
              
                              $percent.css('width', percentage * 100 + '%');
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 3 hrs to fix
              static/editor/dialogs/image/image.js on lines 706..713
              static/editor/dialogs/video/video.js on lines 717..724

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

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

                          function removeFile(file) {
                              var $li = $('#' + file.id);
                              delete percentages[ file.id ];
                              updateTotalProgress();
                              $li.off().find('.file-panel').off().end().remove();
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 2 hrs to fix
              static/editor/dialogs/image/image.js on lines 531..536
              static/editor/dialogs/video/video.js on lines 542..547

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

              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

                      for (var i = 0; i < tabs.length; i++) {
                          domUtils.on(tabs[i], "click", function (e) {
                              var target = e.target || e.srcElement;
                              setTabFocus(target.getAttribute('data-content-id'));
                          });
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 2 hrs to fix
              static/editor/dialogs/image/image.js on lines 24..29

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

              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

                          uploader = _this.uploader = WebUploader.create({
                              pick: {
                                  id: '#filePickerReady',
                                  label: lang.uploadSelectFile
                              },
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 2 hrs to fix
              static/editor/dialogs/video/video.js on lines 384..395

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

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

                      initData: function () {
              
                          /* 拉取数据需要使用的值 */
                          this.state = 0;
                          this.listSize = editor.getOpt('fileManagerListSize');
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 2 hrs to fix
              static/editor/dialogs/background/background.js on lines 238..248
              static/editor/dialogs/image/image.js on lines 836..846

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

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

                          uploader.on('filesQueued', function (file) {
                              if (!uploader.isInProgress() && (state == 'pedding' || state == 'finish' || state == 'confirm' || state == 'ready')) {
                                  setState('ready');
                              }
                              updateTotalProgress();
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 2 hrs to fix
              static/editor/dialogs/image/image.js on lines 676..681
              static/editor/dialogs/video/video.js on lines 687..692

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

              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

                              case 'upload':
                                  list = uploadFile.getInsertList();
                                  var count = uploadFile.getQueueCount();
                                  if (count) {
                                      $('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>');
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 2 hrs to fix
              static/editor/dialogs/image/image.js on lines 89..96

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

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

                          uploader.on('fileQueued', function (file) {
                              fileCount++;
                              fileSize += file.size;
              
                              if (fileCount === 1) {
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 1 hr to fix
              static/editor/dialogs/image/image.js on lines 656..666
              static/editor/dialogs/video/video.js on lines 667..677

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

              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

                          for (var i = 0; i < tabs.length; i++) {
                              if (domUtils.hasClass(tabs[i], 'focus')) {
                                  id = tabs[i].getAttribute('data-content-id');
                                  break;
                              }
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 1 hr to fix
              static/editor/dialogs/image/image.js on lines 78..83

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

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

                                  if (!file.ext || acceptExtensions.indexOf(file.ext.toLowerCase()) == -1) {
                                      showError('not_allow_type');
                                      uploader.removeFile(file);
                                  }
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 1 hr to fix
              static/editor/dialogs/image/image.js on lines 460..463
              static/editor/dialogs/video/video.js on lines 471..474

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

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

                  function UploadFile(target) {
                      this.$wrap = target.constructor == String ? $('#' + target) : $(target);
                      this.init();
                  }
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 1 hr to fix
              static/editor/dialogs/image/image.js on lines 290..293
              static/editor/dialogs/video/video.js on lines 313..316

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

              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

                  function OnlineFile(target) {
                      this.container = utils.isString(target) ? document.getElementById(target) : target;
                      this.init();
                  }
              Severity: Major
              Found in static/editor/dialogs/attachment/attachment.js and 3 other locations - About 55 mins to fix
              static/editor/dialogs/background/background.js on lines 184..187
              static/editor/dialogs/image/image.js on lines 146..149
              static/editor/dialogs/image/image.js on lines 789..792

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

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

                          uploader.on('fileDequeued', function (file) {
                              fileCount--;
                              fileSize -= file.size;
              
                              removeFile(file);
              Severity: Minor
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 35 mins to fix
              static/editor/dialogs/image/image.js on lines 668..674
              static/editor/dialogs/video/video.js on lines 679..685

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

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

                          uploader.on('error', function (code, file) {
                              if (code == 'Q_TYPE_DENIED' || code == 'F_EXCEED_SIZE') {
                                  addFile(file);
                              }
                          });
              Severity: Minor
              Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 30 mins to fix
              static/editor/dialogs/image/image.js on lines 733..737
              static/editor/dialogs/video/video.js on lines 748..752

              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