LibreCat/LibreCat

View on GitHub
public/javascripts/librecat.js

Summary

Maintainability
F
1 wk
Test Coverage

File librecat.js has 711 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 *
 * handling mark/unmark
 *
 */
Severity: Major
Found in public/javascripts/librecat.js - About 1 day to fix

    Function link_person has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function link_person(element){
        var type = "";
        type = $(element).attr('data-type');
        var lineId = $(element).attr('id').replace(type + 'link_person_','');
    
    
    Severity: Major
    Found in public/javascripts/librecat.js - About 1 day to fix

      Function add_field has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function add_field(name, placeholder){
              var items = $('#' + name + ' div.row.multirow');
              var index = items.index($('#' + name + ' div.row.multirow').last()) + 1;
              var blueprint = $(items[0]).clone();
              //var corrected_index = index;
      Severity: Major
      Found in public/javascripts/librecat.js - About 2 hrs to fix

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

        function link_person(element){
            var type = "";
            type = $(element).attr('data-type');
            var lineId = $(element).attr('id').replace(type + 'link_person_','');
        
        
        Severity: Minor
        Found in public/javascripts/librecat.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 edit_file has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function edit_file(fileId){
                var json = jQuery.parseJSON($('#file_' + fileId).val());
                if(json.file_id){
                        $('#id_file_id').val(json.file_id);
                }
        Severity: Major
        Found in public/javascripts/librecat.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                              else if( (old_name.find(o => o.first_name && o.first_name.toLowerCase() === firstname) && lastname == "") || (old_name.find(o => o.last_name && o.last_name.toLowerCase() === lastname) && firstname == "") || (old_name.find(o => o.last_name && o.last_name.toLowerCase() === lastname) && old_name.find(o => o.first_name && o.first_name.toLowerCase() === firstname)) ){
                                  rows += '<tr data-id="' + personId + '" data-orcid="' + orcid + '"><td><a href="' + librecat.uri_base + '/staffdirectory/' + personId + '" target="_blank">' + personId + '</a></td><td class="name" data-firstname="' + first_name + '" data-lastname="' + last_name + '"><a href="#" class="person_link">' + first_name + " " + last_name + '</a></td></tr>';
                                  if(old_name[0]){
                                      for(var j=0;j<old_name.length;j++){
                                          var old_firstname = first_name;
          Severity: Critical
          Found in public/javascripts/librecat.js - About 2 hrs to fix

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

            function edit_file(fileId){
                    var json = jQuery.parseJSON($('#file_' + fileId).val());
                    if(json.file_id){
                            $('#id_file_id').val(json.file_id);
                    }
            Severity: Minor
            Found in public/javascripts/librecat.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 remove_field has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function remove_field(object){
                    var container = $(object).closest('div.multirow');
                    var index = $(container).index();
                    var total = $(container).parent().children('div.multirow').size();
            
            
            Severity: Minor
            Found in public/javascripts/librecat.js - About 1 hr to fix

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

              function enable_autocomplete(field, index) {
                  var type;
                  switch(field) {
                      case "pj":
                          type = "project"
              Severity: Minor
              Found in public/javascripts/librecat.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                                        if(key == "last_name"){
                                            last_name = value;
                                        }
                Severity: Major
                Found in public/javascripts/librecat.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if(key == "first_name"){
                                              first_name = value;
                                          }
                  Severity: Major
                  Found in public/javascripts/librecat.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if(key == "orcid"){
                                                orcid = value;
                                            }
                    Severity: Major
                    Found in public/javascripts/librecat.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if((firstname == first_name.toLowerCase() && lastname == "") || (lastname == last_name.toLowerCase() && firstname == "") || (lastname == last_name.toLowerCase() && firstname == first_name.toLowerCase())){
                                              rows += '<tr data-id="' + personId + '" data-orcid="' + orcid + '"><td><a href="' + librecat.uri_base + '/staffdirectory/' + personId + '" target="_blank">' + personId + '</a></td><td class="name" data-firstname="' + first_name + '" data-lastname="' + last_name + '"><a href="#" class="person_link">' + first_name + " " + last_name + '</a></td></tr>';
                                              if(old_name[0]){
                                                  for(var j=0;j<old_name.length;j++){
                                                      var old_firstname = first_name;
                      Severity: Major
                      Found in public/javascripts/librecat.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if(key == "old_name"){
                                                    old_name = value;
                                                }
                        Severity: Major
                        Found in public/javascripts/librecat.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if(key == "_id"){
                                                      personId = value;
                                                  }
                          Severity: Major
                          Found in public/javascripts/librecat.js - About 45 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                                if((firstname == first_name.toLowerCase() && lastname == "") || (lastname == last_name.toLowerCase() && firstname == "") || (lastname == last_name.toLowerCase() && firstname == first_name.toLowerCase())){
                                                    rows += '<tr data-id="' + personId + '" data-orcid="' + orcid + '"><td><a href="' + librecat.uri_base + '/staffdirectory/' + personId + '" target="_blank">' + personId + '</a></td><td class="name" data-firstname="' + first_name + '" data-lastname="' + last_name + '"><a href="#" class="person_link">' + first_name + " " + last_name + '</a></td></tr>';
                                                    if(old_name[0]){
                                                        for(var j=0;j<old_name.length;j++){
                                                            var old_firstname = first_name;
                            Severity: Major
                            Found in public/javascripts/librecat.js - About 40 mins to fix

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

                                                  else if( (old_name.find(o => o.first_name && o.first_name.toLowerCase() === firstname) && lastname == "") || (old_name.find(o => o.last_name && o.last_name.toLowerCase() === lastname) && firstname == "") || (old_name.find(o => o.last_name && o.last_name.toLowerCase() === lastname) && old_name.find(o => o.first_name && o.first_name.toLowerCase() === firstname)) ){
                                                      rows += '<tr data-id="' + personId + '" data-orcid="' + orcid + '"><td><a href="' + librecat.uri_base + '/staffdirectory/' + personId + '" target="_blank">' + personId + '</a></td><td class="name" data-firstname="' + first_name + '" data-lastname="' + last_name + '"><a href="#" class="person_link">' + first_name + " " + last_name + '</a></td></tr>';
                                                      if(old_name[0]){
                                                          for(var j=0;j<old_name.length;j++){
                                                              var old_firstname = first_name;
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 day to fix
                              public/javascripts/librecat.js on lines 320..355

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

                              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((firstname == first_name.toLowerCase() && lastname == "") || (lastname == last_name.toLowerCase() && firstname == "") || (lastname == last_name.toLowerCase() && firstname == first_name.toLowerCase())){
                                                      rows += '<tr data-id="' + personId + '" data-orcid="' + orcid + '"><td><a href="' + librecat.uri_base + '/staffdirectory/' + personId + '" target="_blank">' + personId + '</a></td><td class="name" data-firstname="' + first_name + '" data-lastname="' + last_name + '"><a href="#" class="person_link">' + first_name + " " + last_name + '</a></td></tr>';
                                                      if(old_name[0]){
                                                          for(var j=0;j<old_name.length;j++){
                                                              var old_firstname = first_name;
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 day to fix
                              public/javascripts/librecat.js on lines 332..355

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

                              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

                                        $(cont).each(function(cindex){
                                                var newindex = parseInt(cindex) + parseInt(index);
                                                var current_container = $(this);
                                                $(current_container).find('input, textarea, img, select, span').each(function(){
                                                        if($(this).attr('id')){
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 day to fix
                              public/javascripts/librecat.js on lines 682..701

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

                              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

                                        $(cont).each(function(cindex){
                                                var newindex = parseInt(cindex) + parseInt(index);
                                                var current_container = $(this);
                                                $(current_container).find('input, textarea, img, select, span').each(function(){
                                                        if($(this).attr('id')){
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 day to fix
                              public/javascripts/librecat.js on lines 730..749

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

                              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 {
                                                      $(this).parent('div.sticky').css("-webkit-box-shadow", "inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6)");
                                                      $(this).parent('div.sticky').css("box-shadow","inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6)");
                                                      $(this).parent('div.sticky').css("border", "1px solid #66afe9");
                                                      $(this).css("box-shadow", "inset 0 1px 1px -1px rgba(0, 0, 0, 0.075), 0 0 8px -8px rgba(102, 175, 233, 0.6)");
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 2 hrs to fix
                              public/javascripts/librecat.js on lines 812..817

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

                              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($(this).parent('div.sticky').hasClass('mandatory')){
                                                      $(this).parent('div.sticky').css("-webkit-box-shadow", "inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d3d3d3");
                                                      $(this).parent('div.sticky').css("box-shadow", "inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d3d3d3");
                                                      $(this).parent('div.sticky').css("border", "1px solid #666");
                                                      $(this).css("box-shadow", "inset 0 1px 1px -1px rgba(0, 0, 0, 0.075), 0 0 6px -6px #d3d3d3");
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 2 hrs to fix
                              public/javascripts/librecat.js on lines 818..823

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

                              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

                                              success: function(res) {
                                                  $('.total-marked').text(res.total);
                                                  a.data('marked', 0);
                                                  a.children('span').removeClass('fa-check-square-o');
                                                  a.children('span').addClass('fa-square-o');
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 2 hrs to fix
                              public/javascripts/librecat.js on lines 17..22

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

                              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

                                              success: function(res) {
                                                  $('.total-marked').text(res.total);
                                                  a.data('marked', 1);
                                                  a.children('span').removeClass('fa-square-o');
                                                  a.children('span').addClass('fa-check-square-o');
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 2 hrs to fix
                              public/javascripts/librecat.js on lines 30..35

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

                              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($(this).attr('id') && $(this).attr('id').match(/idm_extern/)){
                                                      $(this).prop('checked', true);
                                              }
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 hr to fix
                              public/javascripts/librecat.js on lines 712..714

                              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

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

                                                      if($(this).attr('id') && $(this).attr('id').match(/idm_extern/)){
                                                              $(this).prop('checked', true);
                                                      }
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 hr to fix
                              public/javascripts/librecat.js on lines 621..623

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

                                      if($('#' + type + 'idm_extern_' + lineId).is(':checked') && $('#' + type + 'Authorized' + lineId).attr('alt') == "Authorized"){
                                          // Uncheck, release input fields and change img back to gray
                                          $('#' + type + 'Authorized' + lineId).attr('src',librecat.uri_base + '/images/authorized_no.png');
                                          $('#' + type + 'Authorized' + lineId).attr('alt','Not Authorized');
                                          $('#' + type + 'id_' + lineId).val("");
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 hr to fix
                              public/javascripts/librecat.js on lines 211..213

                              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($('#' + type + 'idm_intern_' + lineId).is(':checked') && $('#' + type + 'Authorized' + lineId).attr('alt') == "Authorized"){
                                      return;
                                  }
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 hr to fix
                              public/javascripts/librecat.js on lines 427..438

                              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

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

                                                      if($(this).attr('id') && $(this).attr('id').match(/idm_intern/)){
                                                              $(this).removeAttr('checked');
                                                      }
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 hr to fix
                              public/javascripts/librecat.js on lines 618..620

                              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

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

                                              if($(this).attr('id') && $(this).attr('id').match(/idm_intern/)){
                                                      $(this).removeAttr('checked');
                                              }
                              Severity: Major
                              Found in public/javascripts/librecat.js and 1 other location - About 1 hr to fix
                              public/javascripts/librecat.js on lines 709..711

                              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

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

                                              $('#' + type + 'first_name_' + lineId + ', #' + type + 'last_name_' + lineId).parent().removeClass("has-error");
                              Severity: Minor
                              Found in public/javascripts/librecat.js and 1 other location - About 45 mins to fix
                              public/javascripts/librecat.js on lines 390..390

                              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

                                                  $('#' + type + 'first_name_' + lineId + ', #' + type + 'last_name_' + lineId).parent().removeClass("has-error");
                              Severity: Minor
                              Found in public/javascripts/librecat.js and 1 other location - About 45 mins to fix
                              public/javascripts/librecat.js on lines 273..273

                              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(direction == "edit"){
                                      $('.authorIds').addClass('hidden');
                                      $('.authorIds_input').removeClass('hidden');
                                      $('#author_ids_edit').attr('onclick',"editAuthorIds('cancel')");
                                  }
                              Severity: Minor
                              Found in public/javascripts/librecat.js and 1 other location - About 45 mins to fix
                              public/javascripts/librecat.js on lines 116..120

                              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

                                  else if(direction == "cancel"){
                                      $('.authorIds').removeClass('hidden');
                                      $('.authorIds_input').addClass('hidden');
                                      $('#author_ids_edit').attr('onclick',"editAuthorIds('edit')");
                                  }
                              Severity: Minor
                              Found in public/javascripts/librecat.js and 1 other location - About 45 mins to fix
                              public/javascripts/librecat.js on lines 111..120

                              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

                              There are no issues that match your filters.

                              Category
                              Status