ncbo/bioportal_web_ui

View on GitHub
public/javascripts/widgets/form_complete.js

Summary

Maintainability
F
1 wk
Test Coverage

File form_complete.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// jQuery check, if it's not present then include it
function bpMinVersion(min, actual) {
  function parseVersionString (str) {
    if (typeof(str) != 'string') { return false; }
    var x = str.split('.');
Severity: Minor
Found in public/javascripts/widgets/form_complete.js - About 3 hrs to fix

    Function formComplete_formatItem has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function formComplete_formatItem(row) {
    
        var input = this.extraParams.input;
        var BP_include_definitions = jQuery(input).attr("data-bp_include_definitions");
        if (typeof BP_include_definitions === "undefined") {
    Severity: Major
    Found in public/javascripts/widgets/form_complete.js - About 3 hrs to fix

      Function formComplete_setup_functions has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function formComplete_setup_functions() {
        jQuery("input[class*='bp_form_complete']").each(function(){
          var classes = this.className.split(" ");
          var values;
          var ontology_id;
      Severity: Major
      Found in public/javascripts/widgets/form_complete.js - About 2 hrs to fix

        Function formComplete_formatItem has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        function formComplete_formatItem(row) {
        
            var input = this.extraParams.input;
            var BP_include_definitions = jQuery(input).attr("data-bp_include_definitions");
            if (typeof BP_include_definitions === "undefined") {
        Severity: Minor
        Found in public/javascripts/widgets/form_complete.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 bpMinVersion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function bpMinVersion(min, actual) {
          function parseVersionString (str) {
            if (typeof(str) != 'string') { return false; }
            var x = str.split('.');
            var maj = parseInt(x[0]) || 0;
        Severity: Minor
        Found in public/javascripts/widgets/form_complete.js - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        function bpFormSelect(li) {
          var input = this.extraParams.input;
          switch (this.extraParams.target_property) {
            case "uri":
              jQuery(input).val(li.extra[3])
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 1 day to fix
        app/assets/javascripts/bp_form_complete.js on lines 191..209

        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 jQuery == 'undefined') {
          var jq, jqMigrate, scriptLoc = document.getElementsByTagName('script')[0].parentElement;
          jq = document.createElement('script');
          jqMigrate = document.createElement('script');
          jq.type = jqMigrate.type = "text/javascript";
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 1 day to fix
        public/javascripts/widgets/quick_jump.js on lines 32..52

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

        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

        function bpMinVersion(min, actual) {
          function parseVersionString (str) {
            if (typeof(str) != 'string') { return false; }
            var x = str.split('.');
            var maj = parseInt(x[0]) || 0;
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 1 day to fix
        public/javascripts/widgets/quick_jump.js on lines 3..30

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

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

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

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

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

        Refactorings

        Further Reading

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

        function truncateText(text, max_length) {
          if (typeof max_length === 'undefined' || max_length == "") {
            max_length = 70;
          }
        
        
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 2 other locations - About 1 day to fix
        app/assets/javascripts/bp_form_complete.js on lines 211..239
        public/javascripts/widgets/quick_jump.js on lines 300..320

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

        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 (ontology_id !== "") {
                if (BP_include_definitions) {
                    resultDiv.append(definitionDiv(result_ont_version, result_uri));
                }
                resultDiv.append(resultClassDiv);
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 7 hrs to fix
        public/javascripts/widgets/quick_jump.js on lines 206..224

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

        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

        function getWidgetAjaxContent() {
          // Look for anchors with a get_via_ajax class and replace the parent with the resulting ajax call
          $(".get_definition_via_ajax").each(function(){
            var def_link = $(this);
            if (typeof def_link.attr("getting_content") === 'undefined') {
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 6 hrs to fix
        public/javascripts/widgets/quick_jump.js on lines 273..286

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

        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

        function getScript(url){
            return new Promise((resolve, reject) => {
                const script = document.createElement('script')
                script.src = url
                script.async = true
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 6 hrs to fix
        public/javascripts/widgets/quick_jump.js on lines 121..141

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

        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 (row[0].match(regex) == null) {
                var contents = row[6].split("\t");
                var synonym = contents[0] || "";
                synonym = synonym.split(";");
                if (synonym !== "") {
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 5 hrs to fix
        public/javascripts/widgets/quick_jump.js on lines 169..179

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

        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

        function definitionDiv(ont, concept) {
            var definitionAjax = jQuery("<a>");
            definitionAjax.addClass("get_definition_via_ajax");
            definitionAjax.attr("href", BP_SEARCH_SERVER + "/ajax/json_class?callback=?&ontologyid=" + ont + "&conceptid=" + encodeURIComponent(concept));
            var definitionDiv = jQuery("<div>");
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 3 hrs to fix
        public/javascripts/widgets/quick_jump.js on lines 228..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 111.

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

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

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

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

        Refactorings

        Further Reading

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

            if (jQuery('link[href$="' + BP_SEARCH_SERVER + '/javascripts/JqueryPlugins/autocomplete/jquery.autocomplete.css"]')) {
              jQuery("head").append("<link>");
              css = jQuery("head").children(":last");
              css.attr({
                rel:  "stylesheet",
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/bp_form_complete.js on lines 30..38

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 88.

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

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

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

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

        Refactorings

        Further Reading

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

            if (row[0].indexOf("[obsolete]") != -1) {
                row[0] = row[0].replace("[obsolete]", "");
                obsolete_prefix = "<span class='obsolete_class' title='obsolete class'>";
                obsolete_suffix = "</span>";
            } else {
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 2 hrs to fix
        public/javascripts/widgets/quick_jump.js on lines 181..188

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

        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

            var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"), // .*+?|()[]{}\
                keywords = jQuery(input).val().trim().replace(specials, "\\$&").split(' ').join('|'),
                regex = new RegExp('(' + keywords + ')', 'gi');
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 1 other location - About 2 hrs to fix
        public/javascripts/widgets/quick_jump.js on lines 161..163

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 79.

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

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

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

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

        Refactorings

        Further Reading

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

            if (document.getElementById(jQuery(this).attr('name') + "_bioportal_concept_id") == null)
              html += "<input type='hidden' id='" + jQuery(this).attr('name') + "_bioportal_concept_id'>";
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 7 other locations - About 1 hr to fix
        app/assets/javascripts/bp_form_complete.js on lines 175..176
        app/assets/javascripts/bp_form_complete.js on lines 177..178
        app/assets/javascripts/bp_form_complete.js on lines 179..180
        app/assets/javascripts/bp_form_complete.js on lines 181..182
        public/javascripts/widgets/form_complete.js on lines 314..315
        public/javascripts/widgets/form_complete.js on lines 316..317
        public/javascripts/widgets/form_complete.js on lines 318..319

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

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

            if (document.getElementById(jQuery(this).attr('name') + "_bioportal_full_id") == null)
              html += "<input type='hidden' id='" + jQuery(this).attr('name') + "_bioportal_full_id'>";
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 7 other locations - About 1 hr to fix
        app/assets/javascripts/bp_form_complete.js on lines 175..176
        app/assets/javascripts/bp_form_complete.js on lines 177..178
        app/assets/javascripts/bp_form_complete.js on lines 179..180
        app/assets/javascripts/bp_form_complete.js on lines 181..182
        public/javascripts/widgets/form_complete.js on lines 312..313
        public/javascripts/widgets/form_complete.js on lines 314..315
        public/javascripts/widgets/form_complete.js on lines 318..319

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

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

            if (document.getElementById(jQuery(this).attr('name') + "_bioportal_preferred_name") == null)
              html += "<input type='hidden' id='" + jQuery(this).attr('name') + "_bioportal_preferred_name'>";
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 7 other locations - About 1 hr to fix
        app/assets/javascripts/bp_form_complete.js on lines 175..176
        app/assets/javascripts/bp_form_complete.js on lines 177..178
        app/assets/javascripts/bp_form_complete.js on lines 179..180
        app/assets/javascripts/bp_form_complete.js on lines 181..182
        public/javascripts/widgets/form_complete.js on lines 312..313
        public/javascripts/widgets/form_complete.js on lines 314..315
        public/javascripts/widgets/form_complete.js on lines 316..317

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

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

            if (document.getElementById(jQuery(this).attr('name') + "_bioportal_ontology_id") == null)
              html += "<input type='hidden' id='" + jQuery(this).attr('name') + "_bioportal_ontology_id'>";
        Severity: Major
        Found in public/javascripts/widgets/form_complete.js and 7 other locations - About 1 hr to fix
        app/assets/javascripts/bp_form_complete.js on lines 175..176
        app/assets/javascripts/bp_form_complete.js on lines 177..178
        app/assets/javascripts/bp_form_complete.js on lines 179..180
        app/assets/javascripts/bp_form_complete.js on lines 181..182
        public/javascripts/widgets/form_complete.js on lines 312..313
        public/javascripts/widgets/form_complete.js on lines 316..317
        public/javascripts/widgets/form_complete.js on lines 318..319

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

        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