SysMO-DB/seek

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

Summary

Maintainability
F
1 wk
Test Coverage

File assays.js has 450 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var sops_assets=new Array();
var models_assets=new Array();
var data_files_assets=new Array();
var organisms = new Array();
var assays_array = new Array();
Severity: Minor
Found in app/assets/javascripts/assays.js - About 6 hrs to fix

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

    function updateOrganisms() {
        organism_text='<ul class="related_asset_list">';    
    
        for (var i=0;i<organisms.length;i++) {
            organism=organisms[i];
    Severity: Major
    Found in app/assets/javascripts/assays.js - About 2 hrs to fix

      Function addSelectedOrganism has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      function addSelectedOrganism() {
          selected_option_index=$("possible_organisms").selectedIndex;
          selected_option=$("possible_organisms").options[selected_option_index];
          title=selected_option.text;
          id=selected_option.value;
      Severity: Minor
      Found in app/assets/javascripts/assays.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 addSelectedOrganism has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function addSelectedOrganism() {
          selected_option_index=$("possible_organisms").selectedIndex;
          selected_option=$("possible_organisms").options[selected_option_index];
          title=selected_option.text;
          id=selected_option.value;
      Severity: Minor
      Found in app/assets/javascripts/assays.js - About 1 hr to fix

        Function updateAssays has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function updateAssays() {
            assay_text = '<ul class="related_asset_list">'
            for (var i=0;i<assays_array.length;i++) {
                assay=assays_array[i];
                title=assay[0];
        Severity: Minor
        Found in app/assets/javascripts/assays.js - About 1 hr to fix

          Function updateOrganisms has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function updateOrganisms() {
              organism_text='<ul class="related_asset_list">';    
          
              for (var i=0;i<organisms.length;i++) {
                  organism=organisms[i];
          Severity: Minor
          Found in app/assets/javascripts/assays.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 updateDataFiles has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function updateDataFiles() {
              data_file_text='<ul class="related_asset_list">'
              
              for (var i=0;i<data_files_assets.length;i++) {        
                  data_file=data_files_assets[i];
          Severity: Minor
          Found in app/assets/javascripts/assays.js - About 1 hr to fix

            Function updateModels has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function updateModels() {
                model_text='<ul class="related_asset_list">';
                type="Model";
                model_ids=new Array();
            
            
            Severity: Minor
            Found in app/assets/javascripts/assays.js - About 1 hr to fix

              Function updateSops has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function updateSops() {
                  sop_text='<ul class="related_asset_list">';
              
                  sop_ids=new Array();
              
              
              Severity: Minor
              Found in app/assets/javascripts/assays.js - About 1 hr to fix

                Function updateAssays has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function updateAssays() {
                    assay_text = '<ul class="related_asset_list">'
                    for (var i=0;i<assays_array.length;i++) {
                        assay=assays_array[i];
                        title=assay[0];
                Severity: Minor
                Found in app/assets/javascripts/assays.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 addOrganism has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function addOrganism(title,id,strain_info,strain_id,culture_growth,t_id,t_title) {
                Severity: Major
                Found in app/assets/javascripts/assays.js - About 50 mins to fix

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

                  function updateDataFiles() {
                      data_file_text='<ul class="related_asset_list">'
                      
                      for (var i=0;i<data_files_assets.length;i++) {        
                          data_file=data_files_assets[i];
                  Severity: Minor
                  Found in app/assets/javascripts/assays.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

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

                  function updateSops() {
                      sop_text='<ul class="related_asset_list">';
                  
                      sop_ids=new Array();
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/assays.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 addSelectedAssay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function addSelectedAssay() {
                      selected_option_index=$("possible_assays").selectedIndex;
                      selected_option=$("possible_assays").options[selected_option_index];
                      title=selected_option.text;
                      id=selected_option.value;
                  Severity: Minor
                  Found in app/assets/javascripts/assays.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 addSelectedDataFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function addSelectedDataFile() {
                      selected_option_index=$("possible_data_files").selectedIndex;
                      selected_option=$("possible_data_files").options[selected_option_index];
                      title=selected_option.text;
                      id=selected_option.value;
                  Severity: Minor
                  Found in app/assets/javascripts/assays.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 updateModels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function updateModels() {
                      model_text='<ul class="related_asset_list">';
                      type="Model";
                      model_ids=new Array();
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/assays.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

                  function addSelectedAssay() {
                      selected_option_index=$("possible_assays").selectedIndex;
                      selected_option=$("possible_assays").options[selected_option_index];
                      title=selected_option.text;
                      id=selected_option.value;
                  Severity: Major
                  Found in app/assets/javascripts/assays.js and 1 other location - About 1 day to fix
                  app/assets/javascripts/assays.js on lines 132..157

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

                  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 addSelectedDataFile() {
                      selected_option_index=$("possible_data_files").selectedIndex;
                      selected_option=$("possible_data_files").options[selected_option_index];
                      title=selected_option.text;
                      id=selected_option.value;
                  Severity: Major
                  Found in app/assets/javascripts/assays.js and 1 other location - About 1 day to fix
                  app/assets/javascripts/assays.js on lines 305..330

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

                  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

                      for (var i=0;i<assays_array.length;i++) {
                          assay=assays_array[i];
                          title=assay[0];
                          id=assay[1];
                          relationshipType = assay[2];
                  Severity: Major
                  Found in app/assets/javascripts/assays.js and 1 other location - About 6 hrs to fix
                  app/assets/javascripts/assays.js on lines 168..178

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

                  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

                      for (var i=0;i<data_files_assets.length;i++) {        
                          data_file=data_files_assets[i];
                          title=data_file[0];
                          id=data_file[1];
                          relationshipType = data_file[2];
                  Severity: Major
                  Found in app/assets/javascripts/assays.js and 1 other location - About 6 hrs to fix
                  app/assets/javascripts/assays.js on lines 334..344

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 158.

                  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 addSelectedSop() {
                      selected_option_index=$("possible_sops").selectedIndex;
                      selected_option=$("possible_sops").options[selected_option_index];
                      title=selected_option.text;
                      id=selected_option.value;
                  Severity: Major
                  Found in app/assets/javascripts/assays.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/assays.js on lines 216..234

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

                  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 addSelectedModel() {
                      selected_option_index=$("possible_models").selectedIndex;
                      selected_option=$("possible_models").options[selected_option_index];
                      title=selected_option.text;
                      id=selected_option.value;
                  Severity: Major
                  Found in app/assets/javascripts/assays.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/assays.js on lines 53..73

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

                  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

                      for (i=0;i<data_files_assets.length;i++) {
                          id=data_files_assets[i][1];
                          relationshipType=data_files_assets[i][2];
                          o=document.createElement('option');
                          o.value=id + "," + relationshipType;
                  Severity: Major
                  Found in app/assets/javascripts/assays.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/publication.js on lines 67..80

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

                  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 check_show_add_assay() {
                      i = $('possible_assays').selectedIndex;
                      selected_id = $('possible_assays').options[i].value;
                      if (selected_id == '0') {
                          $('add_assay_link').hide();
                  Severity: Major
                  Found in app/assets/javascripts/assays.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/associate_events.js on lines 2..11

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

                  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