ucsdlib/damspas

View on GitHub
app/assets/javascripts/edit.js

Summary

Maintainability
F
1 wk
Test Coverage

File edit.js has 534 lines of code (exceeds 250 allowed). Consider refactoring.
Open

function getAutocompleteList_callback(formtype,fieldname,elementID,elementLabel){
    
    
    var IDTag='#'+elementID;
    var typeaheadLabelTag='#'+elementLabel+'.typeahead';
Severity: Major
Found in app/assets/javascripts/edit.js - About 1 day to fix

    Function getAutocompleteList_callback has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getAutocompleteList_callback(formtype,fieldname,elementID,elementLabel){
        
        
        var IDTag='#'+elementID;
        var typeaheadLabelTag='#'+elementLabel+'.typeahead';
    Severity: Major
    Found in app/assets/javascripts/edit.js - About 2 hrs to fix

      Function processForm_generic has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function processForm_generic(objType) {
          
          var attributesArray =new Array("assembledCollection","provenanceCollection","provenanceCollectionPart","complexSubject","statute","license","copyright","language","unit","rightsHolderPersonal");
          fieldId = "";
          for (var j in attributesArray) {
      Severity: Minor
      Found in app/assets/javascripts/edit.js - About 2 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 processForm_generic has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function processForm_generic(objType) {
          
          var attributesArray =new Array("assembledCollection","provenanceCollection","provenanceCollectionPart","complexSubject","statute","license","copyright","language","unit","rightsHolderPersonal");
          fieldId = "";
          for (var j in attributesArray) {
      Severity: Major
      Found in app/assets/javascripts/edit.js - About 2 hrs to fix

        Function getDynamicFields has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getDynamicFields(link,type,location,fieldId,typeName,selectedValue,relationship,selectedRole)
        {  
          var q = null;
          var fieldName = null;
          var typeGet = null;
        Severity: Major
        Found in app/assets/javascripts/edit.js - About 2 hrs to fix

          Function getTypeaheadFields has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getTypeaheadFields(linkTag,formType,location,fieldId,typeName,selectedValue,selectedLabel)
          {  
            
            var q = null;
            var fieldName = null;
          Severity: Major
          Found in app/assets/javascripts/edit.js - About 2 hrs to fix

            Function getMultiAutoCompleteList has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getMultiAutoCompleteList(fieldName){ 
            
             var subjectLocal = new Bloodhound({
                datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
                queryTokenizer: Bloodhound.tokenizers.whitespace,
            Severity: Minor
            Found in app/assets/javascripts/edit.js - About 1 hr to fix

              Function removeEmptyFields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              function removeEmptyFields() {
                var inputElements= document.getElementsByClassName("input-block-level");
                var fieldId = "";
                var inputElementsArray = new Array();
                for (var i=0;i<inputElements.length;i++) {
              Severity: Minor
              Found in app/assets/javascripts/edit.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 removeEmptyFields has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function removeEmptyFields() {
                var inputElements= document.getElementsByClassName("input-block-level");
                var fieldId = "";
                var inputElementsArray = new Array();
                for (var i=0;i<inputElements.length;i++) {
              Severity: Minor
              Found in app/assets/javascripts/edit.js - About 1 hr to fix

                Function getEditDynamicFields has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getEditDynamicFields(link,type,location,typeName)
                {  
                  var q = link.value;
                  var typeGet = null;
                  var reg = null;
                Severity: Minor
                Found in app/assets/javascripts/edit.js - About 1 hr to fix

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

                  function getEditTypeaheadFields(linkTag,formType,location,fieldId,typeName)
                  {  
                    var q = linkTag.value;
                    var typeGet = null;
                    var reg = null;
                  Severity: Minor
                  Found in app/assets/javascripts/edit.js - About 1 hr to fix

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

                    function getSingleAutoCompleteList(){ 
                    
                    var subjectLOC = new Bloodhound({
                        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
                        queryTokenizer: Bloodhound.tokenizers.whitespace,
                    Severity: Minor
                    Found in app/assets/javascripts/edit.js - About 1 hr to fix

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

                      function getDynamicFields(link,type,location,fieldId,typeName,selectedValue,relationship,selectedRole)
                      Severity: Major
                      Found in app/assets/javascripts/edit.js - About 1 hr to fix

                        Function getDynamicFields has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function getDynamicFields(link,type,location,fieldId,typeName,selectedValue,relationship,selectedRole)
                        {  
                          var q = null;
                          var fieldName = null;
                          var typeGet = null;
                        Severity: Minor
                        Found in app/assets/javascripts/edit.js - About 55 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

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

                        function getTypeaheadFields(linkTag,formType,location,fieldId,typeName,selectedValue,selectedLabel)
                        Severity: Major
                        Found in app/assets/javascripts/edit.js - About 50 mins to fix

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

                          function getEditTypeaheadFields(linkTag,formType,location,fieldId,typeName)
                          Severity: Minor
                          Found in app/assets/javascripts/edit.js - About 35 mins to fix

                            Function getEditDynamicFields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getEditDynamicFields(link,type,location,typeName)
                            {  
                              var q = link.value;
                              var typeGet = null;
                              var reg = null;
                            Severity: Minor
                            Found in app/assets/javascripts/edit.js - About 35 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

                            Function getTypeaheadFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getTypeaheadFields(linkTag,formType,location,fieldId,typeName,selectedValue,selectedLabel)
                            {  
                              
                              var q = null;
                              var fieldName = null;
                            Severity: Minor
                            Found in app/assets/javascripts/edit.js - About 25 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

                            Function checkOption has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function checkOption(id,isId,type) {
                              if( isId == true && $("#"+id).val().indexOf("Create New") >= 0) {
                              if(type.indexOf("mads") < 0 && type.indexOf("dams") < 0) {    
                                type = getObjectsPath(type);
                              }  
                            Severity: Minor
                            Found in app/assets/javascripts/edit.js - About 25 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

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

                                if($(objType+"cartographics_attributes_0_point").val() != null && $(objType+"cartographics_attributes_0_line").val() != null && 
                                  $(objType+"cartographics_attributes_0_point").val().length < 1 && $(objType+"cartographics_attributes_0_line").val().length < 1)
                                {
                                  $("#cartographicsSection").remove();
                                }    
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 4 hrs to fix
                            app/assets/javascripts/edit.js on lines 490..494

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

                            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($(objType+"relatedResource_attributes_0_description").val() != null && $(objType+"relatedResource_attributes_0_type").val() != null && 
                                  $(objType+"relatedResource_attributes_0_description").val().length < 1 && $(objType+"relatedResource_attributes_0_type").val().length < 1 )
                                {
                                  $("#relatedResourceSection").remove();
                                }
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 4 hrs to fix
                            app/assets/javascripts/edit.js on lines 496..500

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

                            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 (typeName == 'simpleSubject') {
                                typeGet = "subject";
                                reg = "newSimpleSubjects";
                              }
                              else if (typeName == 'creator') {
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 3 hrs to fix
                            app/assets/javascripts/edit.js on lines 332..347

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

                            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 (typeName == 'simpleSubject') {
                                typeGet = "subject";
                                reg = "newSimpleSubjects";
                              }
                              else if (typeName == 'creator') {
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 3 hrs to fix
                            app/assets/javascripts/edit.js on lines 394..409

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

                            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

                            var subjectLOC = new Bloodhound({
                                datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
                                queryTokenizer: Bloodhound.tokenizers.whitespace,
                                remote: {
                                    url:'/dc/qa/search/loc/subjects?q=%QUERY',
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 3 hrs to fix
                            app/assets/javascripts/edit.js on lines 158..169

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

                            var subjectLOC = new Bloodhound({
                                datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
                                queryTokenizer: Bloodhound.tokenizers.whitespace,
                                remote: {
                                    url:'/dc/qa/search/loc/subjects?q=%QUERY',
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 3 hrs to fix
                            app/assets/javascripts/edit.js on lines 106..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 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

                              for (var i=0;i<inputElements.length;i++) {
                                if(inputElements[i].value != null && inputElements[i].value.length < 1) {     
                                  fieldId = "#"+inputElements[i].id;
                                  inputElementsArray.push(fieldId);
                                }
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 2 other locations - About 3 hrs to fix
                            app/assets/javascripts/edit.js on lines 621..626
                            app/assets/javascripts/edit.js on lines 629..634

                            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

                              for (var i=0;i<inputElements.length;i++) {
                                if(inputElements[i].value != null && inputElements[i].value.length < 1) {     
                                  fieldId = "#"+inputElements[i].id;
                                  inputElementsArray.push(fieldId);
                                }
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 2 other locations - About 3 hrs to fix
                            app/assets/javascripts/edit.js on lines 613..618
                            app/assets/javascripts/edit.js on lines 621..626

                            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

                              for (var i=0;i<inputElements.length;i++) {
                                if(inputElements[i].value != null && inputElements[i].value.length < 1) {     
                                  fieldId = "#"+inputElements[i].id;
                                  inputElementsArray.push(fieldId);
                                }
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 2 other locations - About 3 hrs to fix
                            app/assets/javascripts/edit.js on lines 613..618
                            app/assets/javascripts/edit.js on lines 629..634

                            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

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

                              if( isId == true && $("#"+id).val().indexOf("Create New") >= 0) {
                              if(type.indexOf("mads") < 0 && type.indexOf("dams") < 0) {    
                                type = getObjectsPath(type);
                              }  
                                target_popup(baseURL.replace("get_data","")+type+"/new?parent_id="+id);
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 2 hrs to fix
                            app/assets/javascripts/edit.js on lines 572..577

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

                            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

                              } else if( isId == false && $("."+id).val().indexOf("Create New") >= 0) {
                              if(type.indexOf("mads") < 0 && type.indexOf("dams") < 0) {    
                                type = getObjectsPath(type);
                              } 
                                target_popup(baseURL.replace("get_data","")+type+"/new?parent_class="+id);
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 2 hrs to fix
                            app/assets/javascripts/edit.js on lines 567..577

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

                            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($(fieldId).val() != null && $(fieldId).val().length < 1) {
                                    $("#"+subjectsArray[i]).remove();
                                  }     
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 475..477

                            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

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

                                if($(objType+"note_attributes_0_value").val() != null && $(objType+"note_attributes_0_value").val().length < 1)
                                {
                                  $("#noteSection").remove();
                                }
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 2 other locations - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 480..483
                            app/assets/javascripts/edit.js on lines 507..510

                            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

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

                                if($(objType+"language_attributes_0_name").val() != null && $(objType+"language_attributes_0_name").val().length < 1)
                                {
                                  $("#newLanguage").remove();
                                }
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 2 other locations - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 480..483
                            app/assets/javascripts/edit.js on lines 485..488

                            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

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

                                  if($(fieldId).val() != null && $(fieldId).val().length < 1) {
                                    $("#relationship"+relNamesArray[i]).remove();
                                  }     
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 466..468

                            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

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

                                if($(objType+"date_attributes_0_value").val() != null && $(objType+"date_attributes_0_value").val().length < 1)
                                {
                                  $("#dateSection").remove();
                                }
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 2 other locations - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 485..488
                            app/assets/javascripts/edit.js on lines 507..510

                            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

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

                                url = baseURL+"/get_"+typeGet+"/get_"+typeGet+"?selectedRole="+selectedRole+"&relationship="+relationship+"&selectedValue="+selectedValue+"&fieldId="+fieldId+"&fieldName="+fieldName+"&formType="+type+"&q="+q;
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 237..237

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

                            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

                              url = baseURL+"/get_"+typeGet+"/get_"+typeGet+"?selectedValue="+selectedValue+"&selectedLabel="+selectedLabel+"&fieldId="+fieldId+"&fieldName="+fieldName+"&formType="+formType+"&q="+q;
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 349..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 65.

                            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(location != null && location.length > 0)
                                    $(location).html(data);
                                  else
                                    $(link).parent().before(data);
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 251..254

                            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

                                  if(location != null && location.length > 0)
                                    $(location).html(data);
                                  else
                                    $(linkTag).parent().before(data);
                            Severity: Major
                            Found in app/assets/javascripts/edit.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/edit.js on lines 375..378

                            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

                              else {
                                url = baseURL+"/get_"+typeGet+"/get_"+typeGet+"?fieldName="+fieldName+"&formType="+type+"&q="+q;
                              }
                            Severity: Minor
                            Found in app/assets/javascripts/edit.js and 1 other location - About 45 mins to fix
                            app/assets/javascripts/edit.js on lines 413..415

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

                            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 (typeName == 'relationshipName'){
                                url = baseURL+"/get_"+typeGet+"/get_"+typeGet+"?&relationship=true&fieldName="+fieldName+"&formType="+type+"&q="+q;   
                              }
                            Severity: Minor
                            Found in app/assets/javascripts/edit.js and 1 other location - About 45 mins to fix
                            app/assets/javascripts/edit.js on lines 416..418

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

                            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

                                      filter: function(items) {
                                            return $.map(items, function(item) { 
                                                   return { label: item.label, id: item.id }; 
                                            });
                                       }  
                            Severity: Minor
                            Found in app/assets/javascripts/edit.js and 1 other location - About 40 mins to fix
                            app/assets/javascripts/edit.js on lines 19..23

                            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

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

                                      filter: function(items) {
                                            return $.map(items, function(item) { 
                                                   return { label: item.label, id: item.id }; 
                                            });
                                       }  
                            Severity: Minor
                            Found in app/assets/javascripts/edit.js and 1 other location - About 40 mins to fix
                            app/assets/javascripts/edit.js on lines 36..40

                            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