sharetribe/sharetribe

View on GitHub
app/assets/javascripts/admin2/landing_pages.js

Summary

Maintainability
D
2 days
Test Coverage

File landing_pages.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

function readURL(input, render_img) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function(e) {
            render_img.attr('src', e.target.result);
Severity: Minor
Found in app/assets/javascripts/admin2/landing_pages.js - About 3 hrs to fix

    Function initCategory has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function initCategory() {
        $(document).off('click', ".edit-dropdown-list-option-trigger");
        $(document).on('click', '.edit-dropdown-list-option-trigger', function (event) {
            var container = $(this).closest('.categories-list').next('.edit-category-content'),
                remove = $(this).closest('.categories-list').next('.edit-category-content').next('.remove-category-content');
    Severity: Major
    Found in app/assets/javascripts/admin2/landing_pages.js - About 2 hrs to fix

      Function initFooter has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function initFooter() {
      
          $(document).off('click', '#new-footerLink-trigger');
          $(document).on('click', '#new-footerLink-trigger', function(event) {
              var time = new Date().getTime(),
      Severity: Major
      Found in app/assets/javascripts/admin2/landing_pages.js - About 2 hrs to fix

        Function initLandingPage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function initLandingPage(edit){
        
            var id;
        
            if (edit) {
        Severity: Minor
        Found in app/assets/javascripts/admin2/landing_pages.js - About 1 hr to fix

          Function checkedLandingPage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function checkedLandingPage(){
              var back_image = $('#info1ColBackgroundImageWrapper'),
                  back_color = $('#info1ColBackgroundColorWrapper'),
                  url = $('#info1ColCTALabelURLWrapper'),
                  hero_btn = $('#heroCTAButtonLabelURLWrapper'),
          Severity: Minor
          Found in app/assets/javascripts/admin2/landing_pages.js - About 1 hr to fix

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

                    var time = new Date().getTime(),
                        regexp = new RegExp($(this).data('id'), 'g'),
                        templateId = $(this).data('templateId'),
                        entry = $($(templateId).html().replace(regexp, time));
            Severity: Major
            Found in app/assets/javascripts/admin2/landing_pages.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/admin/footer_menu.js on lines 75..78

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 85.

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

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

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

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

            Refactorings

            Further Reading

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

                if ($('#section_cta_button_type_default').prop('checked')) {
                    hero_btn.show();
                    def_text.show();
                    btn_text_label.hide();
                    def_url.hide();
            Severity: Major
            Found in app/assets/javascripts/admin2/landing_pages.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/admin2/landing_pages.js on lines 217..222

            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 ($('#section_cta_button_type_button').prop('checked')) {
                    hero_btn.show();
                    def_text.hide();
                    btn_text_label.show();
                    def_url.show();
            Severity: Major
            Found in app/assets/javascripts/admin2/landing_pages.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/admin2/landing_pages.js on lines 211..216

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

                if ($('#footerlinks').length) {
                    Sortable.create(footerlinks, {
                        handle: '.handle-move',
                        animation: 250,
                        onEnd: function (/**Event*/evt) {
            Severity: Major
            Found in app/assets/javascripts/admin2/landing_pages.js and 2 other locations - About 1 hr to fix
            app/assets/javascripts/admin2/listing_fields.js on lines 8..16
            app/assets/javascripts/admin2/listing_fields.js on lines 17..25

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

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

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

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

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

            Refactorings

            Further Reading

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

                    var container = $(this).closest('.edit-category-content').prev('.categories-list').find('.location-name-lp'),
                        value = $(this).val();
            Severity: Minor
            Found in app/assets/javascripts/admin2/landing_pages.js and 1 other location - About 50 mins to fix
            app/assets/javascripts/admin2/landing_pages.js on lines 60..61

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

                    var container = $(this).closest('.edit-category-content').prev('.categories-list').find('.location-url-lp'),
                        value = $(this).val();
            Severity: Minor
            Found in app/assets/javascripts/admin2/landing_pages.js and 1 other location - About 50 mins to fix
            app/assets/javascripts/admin2/landing_pages.js on lines 67..68

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

                $(document).on('click', '.remove-category-cancel', function(){
                    $(this).closest('.remove-category-content').hide(0);
                });
            Severity: Minor
            Found in app/assets/javascripts/admin2/landing_pages.js and 1 other location - About 30 mins to fix
            app/assets/javascripts/admin2/landing_pages.js on lines 82..84

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

            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('click', ".edit-category-cancel", function(){
                    $(this).closest('.edit-category-content').hide(0);
                });
            Severity: Minor
            Found in app/assets/javascripts/admin2/landing_pages.js and 1 other location - About 30 mins to fix
            app/assets/javascripts/admin2/landing_pages.js on lines 94..96

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

            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