owncloud/core

View on GitHub
core/js/oc-dialogs.js

Summary

Maintainability
F
1 wk
Test Coverage

File oc-dialogs.js has 677 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * ownCloud
 *
 * @author Bartek Przybylski, Christopher Schäpers, Thomas Tanghus
 * @copyright Copyright (c) 2012 Bartek Przybylski bartek@alefzero.eu
Severity: Major
Found in core/js/oc-dialogs.js - About 1 day to fix

    Function fileexists has 280 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        fileexists:function(data, original, replacement, controller) {
            var self = this;
            var dialogDeferred = new $.Deferred();
    
            var getCroppedPreview = function(file) {
    Severity: Major
    Found in core/js/oc-dialogs.js - About 1 day to fix

      Function fileexists has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
      Open

          fileexists:function(data, original, replacement, controller) {
              var self = this;
              var dialogDeferred = new $.Deferred();
      
              var getCroppedPreview = function(file) {
      Severity: Minor
      Found in core/js/oc-dialogs.js - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function message has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          message:function(content, title, dialogType, buttons, callback, modal, cssClass) {
              return $.when(this._getMessageTemplate()).then(function($tmpl) {
                  var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
                  var dialogId = '#' + dialogName;
                  var $dlg = $tmpl.octemplate({
      Severity: Minor
      Found in core/js/oc-dialogs.js - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function filepicker has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          filepicker:function(title, callback, multiselect, mimetypeFilter, modal) {
              var self = this;
              // avoid opening the picker twice
              if (this.filepicker.loading) {
                  return;
      Severity: Major
      Found in core/js/oc-dialogs.js - About 3 hrs to fix

        Function message has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            message:function(content, title, dialogType, buttons, callback, modal, cssClass) {
                return $.when(this._getMessageTemplate()).then(function($tmpl) {
                    var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
                    var dialogId = '#' + dialogName;
                    var $dlg = $tmpl.octemplate({
        Severity: Major
        Found in core/js/oc-dialogs.js - About 2 hrs to fix

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

                  var resampleHermite = function (canvas, W, H, W2, H2) {
                      W2 = Math.round(W2);
                      H2 = Math.round(H2);
                      var img = canvas.getContext("2d").getImageData(0, 0, W, H);
                      var img2 = canvas.getContext("2d").getImageData(0, 0, W2, H2);
          Severity: Major
          Found in core/js/oc-dialogs.js - About 2 hrs to fix

            Function addConflict has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    var addConflict = function($conflicts, original, replacement) {
            
                        var $conflict = $conflicts.find('.template').clone().removeClass('template').addClass('conflict');
                        var $originalDiv = $conflict.find('.original');
                        var $replacementDiv = $conflict.find('.replacement');
            Severity: Major
            Found in core/js/oc-dialogs.js - About 2 hrs to fix

              Function prompt has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  prompt: function (text, title, callback, modal, name, password, buttonDeclineText, buttonConfirmText) {
                      return $.when(this._getMessageTemplate()).then(function ($tmpl) {
                          var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
                          var dialogId = '#' + dialogName;
                          var $dlg = $tmpl.octemplate({
              Severity: Minor
              Found in core/js/oc-dialogs.js - About 1 hr to fix

                Function _fillFilePicker has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _fillFilePicker:function(dir) {
                        var dirs = [];
                        var others = [];
                        var self = this;
                        this.$filelist.empty().addClass('icon-loading');
                Severity: Minor
                Found in core/js/oc-dialogs.js - About 1 hr to fix

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

                      prompt: function (text, title, callback, modal, name, password, buttonDeclineText, buttonConfirmText) {
                          return $.when(this._getMessageTemplate()).then(function ($tmpl) {
                              var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
                              var dialogId = '#' + dialogName;
                              var $dlg = $tmpl.octemplate({
                  Severity: Minor
                  Found in core/js/oc-dialogs.js - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function prompt has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      prompt: function (text, title, callback, modal, name, password, buttonDeclineText, buttonConfirmText) {
                  Severity: Major
                  Found in core/js/oc-dialogs.js - About 1 hr to fix

                    Function message has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        message:function(content, title, dialogType, buttons, callback, modal, cssClass) {
                    Severity: Major
                    Found in core/js/oc-dialogs.js - About 50 mins to fix

                      Function _handlePickerClick has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          _handlePickerClick:function(event, $element) {
                              var getOcDialog = this.$filePicker.closest('.oc-dialog');
                              var buttonEnableDisable = getOcDialog.find('.primary');
                              if ($element.data('type') === 'file') {
                                  if (this.$filePicker.data('multiselect') !== true || !event.ctrlKey) {
                      Severity: Minor
                      Found in core/js/oc-dialogs.js - About 45 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (w >= -1 && w <= 1) {
                                                      //hermite filter
                                                      weight = 2 * w * w * w - 3 * w * w + 1;
                                                      if (weight > 0) {
                                                          dx = 4 * (xx + yy * W);
                      Severity: Major
                      Found in core/js/oc-dialogs.js - About 45 mins to fix

                        Function resampleHermite has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                var resampleHermite = function (canvas, W, H, W2, H2) {
                        Severity: Minor
                        Found in core/js/oc-dialogs.js - About 35 mins to fix

                          Function filepicker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              filepicker:function(title, callback, multiselect, mimetypeFilter, modal) {
                          Severity: Minor
                          Found in core/js/oc-dialogs.js - About 35 mins to fix

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

                                            $(dialogId).on('click', '.original,.allexistingfiles', function(){
                                                var count = $(dialogId).find('.conflict .original input[type="checkbox"]:checked').length;
                                                if (count === $(dialogId+ ' .conflict').length) {
                                                    $(dialogId).find('.allexistingfiles').prop('checked', true);
                                                    $(dialogId).find('.allexistingfiles + .count').text(t('core','(all selected)'));
                            Severity: Major
                            Found in core/js/oc-dialogs.js and 1 other location - About 1 day to fix
                            core/js/oc-dialogs.js on lines 653..666

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

                            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

                                            $(dialogId).on('click', '.replacement,.allnewfiles', function() {
                                                var count = $(dialogId).find('.conflict .replacement input[type="checkbox"]:checked').length;
                                                if (count === $(dialogId+ ' .conflict').length) {
                                                    $(dialogId).find('.allnewfiles').prop('checked', true);
                                                    $(dialogId).find('.allnewfiles + .count').text(t('core','(all selected)'));
                            Severity: Major
                            Found in core/js/oc-dialogs.js and 1 other location - About 1 day to fix
                            core/js/oc-dialogs.js on lines 667..681

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

                            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

                                _getFilePickerTemplate: function() {
                                    var defer = $.Deferred();
                                    if(!this.$filePickerTemplate) {
                                        var self = this;
                                        $.get(OC.filePath('core', 'templates', 'filepicker.html'), function(tmpl) {
                            Severity: Major
                            Found in core/js/oc-dialogs.js and 1 other location - About 7 hrs to fix
                            core/js/tags.js on lines 309..325

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

                            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

                                            $(dialogId).find('.allexistingfiles').on('click', function() {
                                                var $checkboxes = $(dialogId).find('.conflict .original:not(.readonly) input[type="checkbox"]');
                                                $checkboxes.prop('checked', $(this).prop('checked'));
                                            });
                            Severity: Major
                            Found in core/js/oc-dialogs.js and 1 other location - About 1 hr to fix
                            core/js/oc-dialogs.js on lines 635..638

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 71.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                                            $(dialogId).find('.allnewfiles').on('click', function() {
                                                var $checkboxes = $(dialogId).find('.conflict .replacement input[type="checkbox"]');
                                                $checkboxes.prop('checked', $(this).prop('checked'));
                                            });
                            Severity: Major
                            Found in core/js/oc-dialogs.js and 1 other location - About 1 hr to fix
                            core/js/oc-dialogs.js on lines 639..642

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 71.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                                        $.get(OC.filePath('files', 'templates', 'fileexists.html'), function (tmpl) {
                                            self.$fileexistsTemplate = $(tmpl);
                                            defer.resolve(self.$fileexistsTemplate);
                                        })
                                        .fail(function () {
                            Severity: Major
                            Found in core/js/oc-dialogs.js and 1 other location - About 1 hr to fix
                            core/js/oc-dialogs.js on lines 714..720

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

                            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

                                        $.get(OC.filePath('core', 'templates', 'message.html'), function(tmpl) {
                                            self.$messageTemplate = $(tmpl);
                                            defer.resolve(self.$messageTemplate);
                                        })
                                        .fail(function(jqXHR, textStatus, errorThrown) {
                            Severity: Major
                            Found in core/js/oc-dialogs.js and 1 other location - About 1 hr to fix
                            core/js/oc-dialogs.js on lines 730..736

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

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                                    if (this.$filePicker.data('mimetype') === "http/unix-directory") {
                                        buttonEnableDisable.prop("disabled", false);
                                    } else {
                                        buttonEnableDisable.prop("disabled", true);
                                    }
                            Severity: Minor
                            Found in core/js/oc-dialogs.js and 1 other location - About 50 mins to fix
                            core/js/oc-dialogs.js on lines 865..869

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

                            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

                                                click: function () {
                                                    if (callback !== undefined) {
                                                        callback(false, input.val());
                                                    }
                                                    $(dialogId).ocdialog('close');
                            Severity: Minor
                            Found in core/js/oc-dialogs.js and 1 other location - About 50 mins to fix
                            core/js/oc-dialogs.js on lines 120..125

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

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                                        if (this.$filePicker.data('mimetype') === "httpd/unix-directory") {
                                            buttonEnableDisable.prop("disabled", false);
                                        } else {
                                            buttonEnableDisable.prop("disabled", true);
                                        }
                            Severity: Minor
                            Found in core/js/oc-dialogs.js and 1 other location - About 50 mins to fix
                            core/js/oc-dialogs.js on lines 845..849

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

                            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

                                                click        : function () {
                                                    if (callback !== undefined) {
                                                        callback(true, input.val());
                                                    }
                                                    $(dialogId).ocdialog('close');
                            Severity: Minor
                            Found in core/js/oc-dialogs.js and 1 other location - About 50 mins to fix
                            core/js/oc-dialogs.js on lines 112..117

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

                            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