qcminecraft/Carbon-Forum-F

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

Summary

Maintainability
F
1 mo
Test Coverage

File image.js has 964 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/image/image.js - About 2 days to fix

    Function initUploader has 367 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/image/image.js - About 1 day to fix

      Function addFile has 112 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/image/image.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/image/image.js - About 2 hrs to fix

          Function getImageData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

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

                    initEvents: function(){
                        var _this = this;
            
                        /* 点击搜索按钮 */
                        domUtils.on($G('searchBtn'), 'click', function(){
            Severity: Minor
            Found in static/editor/dialogs/image/image.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                          if(data['url']) {
                              return [{
                                  src: data['url'],
                                  _src: data['url'],
                                  width: data['width'] || '',
              Severity: Critical
              Found in static/editor/dialogs/image/image.js - About 1 hr to fix

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

                    function initButtons() {
                
                        dialog.onok = function () {
                            var remote = false, list = [], id, tabs = $G('tabhead').children;
                            for (var i = 0; i < tabs.length; i++) {
                Severity: Minor
                Found in static/editor/dialogs/image/image.js - About 1 hr to fix

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

                          dialog.onok = function () {
                              var remote = false, list = [], id, tabs = $G('tabhead').children;
                              for (var i = 0; i < tabs.length; i++) {
                                  if (domUtils.hasClass(tabs[i], 'focus')) {
                                      id = tabs[i].getAttribute('data-content-id');
                  Severity: Minor
                  Found in static/editor/dialogs/image/image.js - About 1 hr to fix

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

                        function setTabFocus(id) {
                            if(!id) return;
                            var i, bodyId, tabs = $G('tabhead').children;
                            for (i = 0; i < tabs.length; i++) {
                                bodyId = tabs[i].getAttribute('data-content-id');
                    Severity: Minor
                    Found in static/editor/dialogs/image/image.js - About 1 hr to fix

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

                              initEvents: function () {
                                  var _this = this,
                                      locker = $G('lock');
                      
                                  /* 改变url */
                      Severity: Minor
                      Found in static/editor/dialogs/image/image.js - About 1 hr to fix

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

                                getImageData: function(){
                                    var _this = this,
                                        key = $G('searchTxt').value,
                                        type = $G('searchType').value,
                                        keepOriginName = editor.options.keepOriginName ? "1" : "0",
                        Severity: Minor
                        Found in static/editor/dialogs/image/image.js - About 1 hr to fix

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

                                  setList: function (list) {
                                      var i, item, p, img, link, _this = this,
                                          listUl = $G('searchListUl');
                          
                                      listUl.innerHTML = '';
                          Severity: Minor
                          Found in static/editor/dialogs/image/image.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if(src) {
                                            /* 设置表单内容 */
                                            $G("width").value = img.width || '';
                                            $G("height").value = img.height || '';
                                            $G("border").value = img.getAttribute("border") || '0';
                            Severity: Major
                            Found in static/editor/dialogs/image/image.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/image/image.js and 2 other locations - About 3 days to fix
                              static/editor/dialogs/attachment/attachment.js on lines 341..415
                              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

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

                                      getImageData: function () {
                                          var _this = this;
                              
                                          if(!_this.listEnd && !this.isLoadingData) {
                                              this.isLoadingData = true;
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 1 other location - About 2 days to fix
                              static/editor/dialogs/background/background.js on lines 255..296

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

                              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

                                      pushData: function (list) {
                                          var i, item, img, icon, _this = this,
                                              urlPrefix = editor.getOpt('imageManagerUrlPrefix');
                                          for (i = 0; i < list.length; i++) {
                                              if(list[i] && list[i].url) {
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 1 other location - About 2 days to fix
                              static/editor/dialogs/background/background.js on lines 298..322

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

                              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/image/image.js and 2 other locations - About 2 days to fix
                              static/editor/dialogs/attachment/attachment.js on lines 711..736
                              static/editor/dialogs/background/background.js on lines 324..349

                              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/image/image.js and 2 other locations - About 1 day to fix
                              static/editor/dialogs/attachment/attachment.js on lines 182..215
                              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/image/image.js and 2 other locations - About 1 day to fix
                              static/editor/dialogs/attachment/attachment.js on lines 251..273
                              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/image/image.js and 2 other locations - About 1 day to fix
                              static/editor/dialogs/attachment/attachment.js on lines 417..439
                              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('imageList'), 'scroll', function(e){
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 1 other location - About 1 day to fix
                              static/editor/dialogs/attachment/attachment.js on lines 591..614

                              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/image/image.js and 2 other locations - About 1 day to fix
                              static/editor/dialogs/attachment/attachment.js on lines 282..310
                              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/image/image.js and 1 other location - About 7 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 500..514

                              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/image/image.js and 2 other locations - About 7 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 323..339
                              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/image/image.js and 1 other location - About 6 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 225..239

                              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/image/image.js and 2 other locations - About 5 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 468..484
                              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/image/image.js and 1 other location - About 5 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 579..589

                              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/image/image.js and 1 other location - About 4 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 35..44

                              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('imageActionName')) {
                                              $('#filePickerReady').after($('<div>').html(lang.errorLoadConfig)).hide();
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 2 other locations - About 4 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 150..156
                              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/image/image.js and 2 other locations - About 3 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 543..550
                              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/image/image.js and 2 other locations - About 3 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 526..538
                              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

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

                                          domUtils.on($G("width"), 'keyup', function(){
                                              updatePreview();
                                              if(locker.checked) {
                                                  var proportion =locker.getAttribute('data-proportion');
                                                  $G('height').value = Math.round(this.value / proportion);
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 1 other location - About 3 hrs to fix
                              static/editor/dialogs/image/image.js on lines 188..196

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

                              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

                                          domUtils.on($G("height"), 'keyup', function(){
                                              updatePreview();
                                              if(locker.checked) {
                                                  var proportion =locker.getAttribute('data-proportion');
                                                  $G('width').value = Math.round(this.value * proportion);
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 1 other location - About 3 hrs to fix
                              static/editor/dialogs/image/image.js on lines 179..187

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

                              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/image/image.js and 2 other locations - About 3 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 491..498
                              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/image/image.js and 2 other locations - About 2 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 316..321
                              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/image/image.js and 1 other location - About 2 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 21..26

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

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

                              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/image/image.js and 2 other locations - About 2 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 461..466
                              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 = uploadImage.getInsertList();
                                                  var count = uploadImage.getQueueCount();
                                                  if (count) {
                                                      $('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>');
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 1 other location - About 2 hrs to fix
                              static/editor/dialogs/attachment/attachment.js on lines 68..75

                              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/image/image.js and 2 other locations - About 1 hr to fix
                              static/editor/dialogs/attachment/attachment.js on lines 441..451
                              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/image/image.js and 1 other location - About 1 hr to fix
                              static/editor/dialogs/attachment/attachment.js on lines 60..65

                              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/image/image.js and 2 other locations - About 1 hr to fix
                              static/editor/dialogs/attachment/attachment.js on lines 245..248
                              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 UploadImage(target) {
                                      this.$wrap = target.constructor == String ? $('#' + target) : $(target);
                                      this.init();
                                  }
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 2 other locations - About 1 hr to fix
                              static/editor/dialogs/attachment/attachment.js on lines 87..90
                              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 OnlineImage(target) {
                                      this.container = utils.isString(target) ? document.getElementById(target) : target;
                                      this.init();
                                  }
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 3 other locations - About 55 mins to fix
                              static/editor/dialogs/attachment/attachment.js on lines 568..571
                              static/editor/dialogs/background/background.js on lines 184..187
                              static/editor/dialogs/image/image.js on lines 146..149

                              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

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

                                  function RemoteImage(target) {
                                      this.container = utils.isString(target) ? document.getElementById(target) : target;
                                      this.init();
                                  }
                              Severity: Major
                              Found in static/editor/dialogs/image/image.js and 3 other locations - About 55 mins to fix
                              static/editor/dialogs/attachment/attachment.js on lines 568..571
                              static/editor/dialogs/background/background.js on lines 184..187
                              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 2 locations. Consider refactoring.
                              Open

                                                  list.push({
                                                      src: src,
                                                      _src: src,
                                                      alt: src.substr(src.lastIndexOf('/') + 1),
                                                      floatStyle: align
                              Severity: Minor
                              Found in static/editor/dialogs/image/image.js and 1 other location - About 50 mins to fix
                              static/editor/dialogs/image/image.js on lines 954..959

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

                              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

                                                  list.push({
                                                      src: src,
                                                      _src: src,
                                                      alt: src.substr(src.lastIndexOf('/') + 1),
                                                      floatStyle: align
                              Severity: Minor
                              Found in static/editor/dialogs/image/image.js and 1 other location - About 50 mins to fix
                              static/editor/dialogs/image/image.js on lines 1127..1132

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

                              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/image/image.js and 2 other locations - About 35 mins to fix
                              static/editor/dialogs/attachment/attachment.js on lines 453..459
                              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/image/image.js and 2 other locations - About 30 mins to fix
                              static/editor/dialogs/attachment/attachment.js on lines 518..522
                              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