SpeciesFileGroup/taxonworks

View on GitHub
app/assets/javascripts/views/tags/tag_picker.js

Summary

Maintainability
D
2 days
Test Coverage

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

  initialize_autocomplete: function (form) {
    var autocomplete_input = form.find(".keyword_picker_autocomplete");

    autocomplete_input.autocomplete({
      source: '/keywords/lookup_keyword',
Severity: Minor
Found in app/assets/javascripts/views/tags/tag_picker.js - About 1 hr to fix

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

        autocomplete_input.autocomplete({
          source: '/keywords/lookup_keyword',
          open: function (event, ui) {
            TW.views.tags.tag_picker.bind_hover(form);
          },
    Severity: Major
    Found in app/assets/javascripts/views/tags/tag_picker.js and 1 other location - About 6 hrs to fix
    app/assets/javascripts/views/topics/_topic_picker.js on lines 38..53

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

    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

      make_tag_list_sortable: function (form) {
        var list_items = form.find(".tag_list");
        list_items.sortable({
          change: function (event, ui) {
            if ($('form[id^="new_"]').length == 0) {
    Severity: Major
    Found in app/assets/javascripts/views/tags/tag_picker.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/views/people/_role_picker.js on lines 253..263

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

    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

      bind_definition_listener: function (form) {
        form.find(".definition").keyup(function () {
          var d = form.find(".definition").val();
    
          if (d.length == 0) {
    Severity: Major
    Found in app/assets/javascripts/views/tags/tag_picker.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/views/citations/_topic_picker.js on lines 53..63

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 99.

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

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

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

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

    Refactorings

    Further Reading

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

      clear_keyword_picker: function (form) {
        var keyword_picker;
        keyword_picker = form.find('.keyword_picker_autocomplete');
        $(keyword_picker).val("");
        form.find(".new_keyword").attr("hidden", true);
    Severity: Major
    Found in app/assets/javascripts/views/tags/tag_picker.js and 2 other locations - About 1 hr to fix
    app/assets/javascripts/views/people/_role_picker.js on lines 77..82
    app/assets/javascripts/views/topics/_topic_picker.js on lines 28..33

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

    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

        tag_list.append($('<li class="tag_item" data-tag-index="' + random_index + '">').append(label).append('&nbsp;').append(TW.views.tags.tag_picker.remove_link()));
    Severity: Major
    Found in app/assets/javascripts/views/tags/tag_picker.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/views/confidences/form.js on lines 77..77

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 65.

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

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

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

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

    Refactorings

    Further Reading

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

      bind_label_mirroring: function (form) {
        form.find(".keyword_picker_form input").on("change keyup", function () {
          form.find(".name_label").html(
            form.find(".name").val()
          );
    Severity: Major
    Found in app/assets/javascripts/views/tags/tag_picker.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/views/citations/_topic_picker.js on lines 105..111

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

    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

    $(document).on('turbolinks:load', function() {
      $('.tag_picker').each(function () {
        TW.views.tags.tag_picker.initialize_tag_picker($(this));
      });
    });
    Severity: Major
    Found in app/assets/javascripts/views/tags/tag_picker.js and 2 other locations - About 50 mins to fix
    app/assets/javascripts/views/confidences/form.js on lines 14..18
    app/assets/javascripts/views/filter/_area_picker.js on lines 116..121

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

    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

      remove_link: function () {
        var link = $('<a href="#" data-turbolinks="false" class="remove_tag">remove</a>');
        TW.views.tags.tag_picker.bind_remove_links(link);
        return link;
      },
    Severity: Major
    Found in app/assets/javascripts/views/tags/tag_picker.js and 3 other locations - About 35 mins to fix
    app/assets/javascripts/views/confidences/form.js on lines 80..84
    app/assets/javascripts/views/people/_role_picker.js on lines 172..176
    app/assets/javascripts/views/topics/_topic_picker.js on lines 120..124

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

    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