sympmarc/SPServices

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

Summary

Maintainability
F
4 days
Test Coverage

Function SPFilterDropdown has 163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.SPServices.SPFilterDropdown = function (options) {

        var opt = $.extend({}, {
            relationshipWebURL: "", // [Optional] The name of the Web (site) which contains the relationshipList
            relationshipList: "", // The name of the list which contains the lookup values
Severity: Major
Found in src/value-added/SPFilterDropdown.js - About 6 hrs to fix

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

                completefunc: function (xData) {
    
                    // Handle errors
                    $(xData.responseXML).find("errorstring").each(function () {
                        var errorText = $(this).text();
    Severity: Major
    Found in src/value-added/SPFilterDropdown.js - About 3 hrs to fix

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

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

      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

                      $(xData.responseXML).find("errorstring").each(function () {
                          var errorText = $(this).text();
                          if (opt.debug && errorText === "One or more field types are not installed properly. Go to the list settings page to delete these fields.") {
                              utils.errBox(thisFunction,
                                  "relationshipListColumn: " + opt.relationshipListColumn,
      Severity: Major
      Found in src/value-added/SPFilterDropdown.js and 1 other location - About 5 hrs to fix
      src/value-added/SPDisplayRelatedInfo.js on lines 180..192

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

      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/SPFilterDropdown.js and 1 other location - About 2 hrs to fix
      src/value-added/SPCascadeDropdowns.js on lines 309..314

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

      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
                              $(columnSelect.master.candidateControl).find("option").remove();
                              newMultiLookupPickerdata = "";
                              break;
      Severity: Minor
      Found in src/value-added/SPFilterDropdown.js and 1 other location - About 50 mins to fix
      src/value-added/SPCascadeDropdowns.js on lines 288..292

      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 = columnColumnRequired ? "" : opt.noneText + "|0";
                              columnSelect.Obj.val("");
                              break;
      Severity: Minor
      Found in src/value-added/SPFilterDropdown.js and 1 other location - About 50 mins to fix
      src/value-added/SPCascadeDropdowns.js on lines 283..287

      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