sympmarc/SPServices

View on GitHub
src/value-added/SPCascadeDropdowns.js

Summary

Maintainability
F
4 days
Test Coverage

Function cascadeDropdown has 177 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function cascadeDropdown(parentSelect) {
        var choices = "";
        var parentSelectSelected;
        var childSelectSelected = null;
        var newMultiLookupPickerdata;
Severity: Major
Found in src/value-added/SPCascadeDropdowns.js - About 7 hrs to fix

    Function completefunc has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    completefunc: function (xData) {
    
                        // Handle errors
                        $(xData.responseXML).find("errorstring").each(function () {
                            var thisFunction = "SPServices.SPCascadeDropdowns";
    Severity: Major
    Found in src/value-added/SPCascadeDropdowns.js - About 4 hrs to fix

      Function SPCascadeDropdowns has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.fn.SPServices.SPCascadeDropdowns = function (options) {
      
              var opt = $.extend({}, {
                  relationshipWebURL: "", // [Optional] The name of the Web (site) which contains the relationships list
                  relationshipList: "", // The name of the list which contains the parent/child relationships
      Severity: Major
      Found in src/value-added/SPCascadeDropdowns.js - About 4 hrs to fix

        File SPCascadeDropdowns.js has 299 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        define([
            'jquery',
            '../utils/constants',
            '../core/SPServices.utils',
            //---------------------------
        Severity: Minor
        Found in src/value-added/SPCascadeDropdowns.js - About 3 hrs to fix

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

                                  switch (childSelect.Type) {
                                      case constants.dropdownType.simple:
                                          var selected = ($(this).attr("ows_ID") === childSelectSelected[0]) ? " selected='selected'" : "";
                                          childSelect.Obj.append("<option" + selected + " value='" + thisOption.id + "'>" + thisOption.value + "</option>");
                                          break;
          Severity: Major
          Found in src/value-added/SPCascadeDropdowns.js and 1 other location - About 1 day to fix
          src/value-added/SPFilterDropdown.js on lines 165..182

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

          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 (typeof thisValue !== "undefined" && thisValue.indexOf(constants.spDelim) > 0) {
                                      thisOption = new utils.SplitIndex(thisValue);
                                  } else {
                                      thisOption.id = $(this).attr("ows_ID");
                                      thisOption.value = thisValue;
          Severity: Major
          Found in src/value-added/SPCascadeDropdowns.js and 1 other location - About 2 hrs to fix
          src/value-added/SPFilterDropdown.js on lines 151..156

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

          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

                  if (childSelect.Obj.html() === null && opt.debug) {
                      utils.errBox(thisFunction, "childColumn: " + opt.childColumn, constants.TXTColumnNotFound);
                      return;
                  }
          Severity: Major
          Found in src/value-added/SPCascadeDropdowns.js and 3 other locations - About 1 hr to fix
          src/value-added/SPCascadeDropdowns.js on lines 50..53
          src/value-added/SPDisplayRelatedInfo.js on lines 47..50
          src/value-added/SPFilterDropdown.js on lines 50..53

          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

                  if (parentSelect.Obj.html() === null && opt.debug) {
                      utils.errBox(thisFunction, "parentColumn: " + opt.parentColumn, constants.TXTColumnNotFound);
                      return;
                  }
          Severity: Major
          Found in src/value-added/SPCascadeDropdowns.js and 3 other locations - About 1 hr to fix
          src/value-added/SPCascadeDropdowns.js on lines 59..62
          src/value-added/SPDisplayRelatedInfo.js on lines 47..50
          src/value-added/SPFilterDropdown.js on lines 50..53

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

                                  case constants.dropdownType.multiSelect:
                                      // Remove all of the existing options
                                      $(childSelect.master.candidateControl).find("option").remove();
                                      newMultiLookupPickerdata = "";
                                      break;
          Severity: Minor
          Found in src/value-added/SPCascadeDropdowns.js and 1 other location - About 50 mins to fix
          src/value-added/SPFilterDropdown.js on lines 133..137

          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

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

                                  case constants.dropdownType.complex:
                                      // If the column is required, don't add the "(None)" option
                                      choices = childColumnRequired ? "" : opt.noneText + "|0";
                                      childSelect.Obj.val("");
                                      break;
          Severity: Minor
          Found in src/value-added/SPCascadeDropdowns.js and 1 other location - About 50 mins to fix
          src/value-added/SPFilterDropdown.js on lines 128..132

          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

                          camlQuery += "<Eq><FieldRef Name='" + opt.relationshipListParentColumn +
                              (opt.matchOnId ? "' LookupId='True'/><Value Type='Integer'>" : "'/><Value Type='Text'>") +
                              utils.escapeColumnValue(parentSelectSelected[0]) + "</Value></Eq>";
          Severity: Minor
          Found in src/value-added/SPCascadeDropdowns.js and 1 other location - About 40 mins to fix
          src/value-added/SPDisplayRelatedInfo.js on lines 148..150

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

          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