SpeciesFileGroup/taxonworks

View on GitHub
app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js

Summary

Maintainability
D
2 days
Test Coverage

Function init has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  init: function () {
    var whereIgo = location.pathname.replace('index', '');

    var start_next = 0;
    TW.views.tasks.collecting_events.parse.dates.bind_radio_buttons();

    Function bind_radio_buttons has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      bind_radio_buttons: function () {     // for regex match table
        $('.select_dates').click(function () {
          // selector not working
          var start_date = $(this).parent().parent('.extract_row').children('.start_date_value').text();
          var end_date = $(this).parent().parent('.extract_row').children('.end_date_value').text();

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

            $.get('similar_labels', params, function (local_data) {
              $("#match_count").text(local_data.count);
              $("#matching_span").html(local_data.table);
              $("#matched_start_date").val(start_date);
              $("#matched_end_date").val(end_date);
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 112..118

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

      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

            $.get('similar_labels', params, function (local_data) {
              $("#match_count").text(local_data.count);
              $("#matching_span").html(local_data.table);
              $("#matched_start_date").val(start_date);
              $("#matched_end_date").val(end_date);
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 34..40

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 116.

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

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

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

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

      Refactorings

      Further Reading

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

          sel_all.click(function (event) {
            // find all the checkboxes in the 'matching_span' and set them to 'checked'
            // class is selectable_select
            for (var i = 0; i < selectable.length; i++) {
              selectable[i]['checked'] = true;
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 77..84
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 58..65
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 67..74

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

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

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

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

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

      Refactorings

      Further Reading

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

          des_all.click(function (event) {
            // find all the checkboxes in the 'matching_span' and set them to 'checked'
            // class is selectable_select
            for (var i = 0; i < selectable.length; i++) {
              selectable[i]['checked'] = false;
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 68..75
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 58..65
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 67..74

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

      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

      $(document).on("turbolinks:load", function () {
        if ($("#ce_parse_dates").length) {
          //  var _init_lat_long_parse = TW.views.tasks.collecting_events.parse;
          // _init_lat_long_parse.init();
          TW.views.tasks.collecting_events.parse.dates.init();
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 113..119

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

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

          $('#skip').click(function (event) {
            event.preventDefault();
            location.href = whereIgo + 'skip?' + $('#dates_convert_form').serialize();
          });
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 44..47
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 55..58
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 29..32
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 34..37

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

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

          $('#re_eval').click(function (event) {
            event.preventDefault();
            location.href = whereIgo + 'index?' + $('#dates_convert_form').serialize();
          });
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 49..52
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 55..58
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 29..32
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 34..37

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

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

          $('#save_selected').click(function (event) {
            event.preventDefault();
            location.href = whereIgo + 'save_selected?' + $('#dates_convert_form').serialize();
          });
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 44..47
      app/assets/javascripts/views/tasks/collecting_events/parse/dates/index.js on lines 49..52
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 29..32
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 34..37

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

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

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

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

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

      Refactorings

      Further Reading

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

      TW.views.tasks.collecting_events.parse.dates = TW.views.tasks.collecting_events.parse.dates || {};
      app/assets/javascripts/vendor/lib/google/maps/draw.js on lines 9..9
      app/assets/javascripts/views/tasks/collecting_events/parse/lat_long/index.js on lines 6..6

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status