monsij/StudentPortal

View on GitHub
pro1/staticfiles/admin/js/inlines.js

Summary

Maintainability
F
5 days
Test Coverage

Function formset has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.formset = function(opts) {
        var options = $.extend({}, $.fn.formset.defaults, opts);
        var $this = $(this);
        var $parent = $this.parent();
        var updateElementIndex = function(el, prefix, ndx) {
Severity: Major
Found in pro1/staticfiles/admin/js/inlines.js - About 3 hrs to fix

    Function stackedFormset has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        $.fn.stackedFormset = function(selector, options) {
            var $rows = $(this);
            var updateInlineLabel = function(row) {
                $(selector).find(".inline_label").each(function(i) {
                    var count = i + 1;
    Severity: Major
    Found in pro1/staticfiles/admin/js/inlines.js - About 2 hrs to fix

      Function tabularFormset has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.fn.tabularFormset = function(selector, options) {
              var $rows = $(this);
              var alternatingRows = function(row) {
                  $(selector).not(".add-row").removeClass("row1 row2")
                  .filter(":even").addClass("row1").end()
      Severity: Major
      Found in pro1/staticfiles/admin/js/inlines.js - About 2 hrs to fix

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

                var initPrepopulatedFields = function(row) {
                    row.find('.prepopulated_field').each(function() {
                        var field = $(this),
                            input = field.find('input, select, textarea'),
                            dependency_list = input.data('dependency_list') || [],
        Severity: Major
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 7 hrs to fix
        pro1/staticfiles/admin/js/inlines.js on lines 179..192

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

        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 initPrepopulatedFields = function(row) {
                    row.find('.prepopulated_field').each(function() {
                        var field = $(this),
                            input = field.find('input, select, textarea'),
                            dependency_list = input.data('dependency_list') || [],
        Severity: Major
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 7 hrs to fix
        pro1/staticfiles/admin/js/inlines.js on lines 246..259

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

        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 (typeof SelectFilter !== 'undefined') {
                        $('.selectfilter').each(function(index, value) {
                            var namearr = value.name.split('-');
                            SelectFilter.init(value.id, namearr[namearr.length - 1], false);
                        });
        Severity: Major
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 5 hrs to fix
        pro1/staticfiles/admin/js/inlines.js on lines 234..243

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

        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 (typeof SelectFilter !== "undefined") {
                        $(".selectfilter").each(function(index, value) {
                            var namearr = value.name.split('-');
                            SelectFilter.init(value.id, namearr[namearr.length - 1], false);
                        });
        Severity: Major
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 5 hrs to fix
        pro1/staticfiles/admin/js/inlines.js on lines 167..176

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

        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

                $rows.formset({
                    prefix: options.prefix,
                    addText: options.addText,
                    formCssClass: "dynamic-" + options.prefix,
                    deleteCssClass: "inline-deletelink",
        Severity: Major
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 3 hrs to fix
        pro1/staticfiles/admin/js/inlines.js on lines 194..209

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

        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

                $rows.formset({
                    prefix: options.prefix,
                    addText: options.addText,
                    formCssClass: "dynamic-" + options.prefix,
                    deleteCssClass: "inline-deletelink",
        Severity: Major
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 3 hrs to fix
        pro1/staticfiles/admin/js/inlines.js on lines 261..276

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

        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 reinitDateTimeShortCuts = function() {
                    // Reinitialize the calendar and clock widgets by force
                    if (typeof DateTimeShortcuts !== "undefined") {
                        $(".datetimeshortcuts").remove();
                        DateTimeShortcuts.init();
        Severity: Minor
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 50 mins to fix
        pro1/staticfiles/admin/js/inlines.js on lines 224..230

        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 reinitDateTimeShortCuts = function() {
                    // Reinitialize the calendar and clock widgets by force, yuck.
                    if (typeof DateTimeShortcuts !== "undefined") {
                        $(".datetimeshortcuts").remove();
                        DateTimeShortcuts.init();
        Severity: Minor
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 50 mins to fix
        pro1/staticfiles/admin/js/inlines.js on lines 156..162

        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

                        if (row.is("tr")) {
                            // If the forms are laid out in table rows, insert
                            // the remove button into the last table cell:
                            row.children(":last").append('<div><a class="' + options.deleteCssClass + '" href="#">' + options.deleteText + "</a></div>");
                        } else if (row.is("ul") || row.is("ol")) {
        Severity: Minor
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 40 mins to fix
        pro1/staticfiles/admin/js/inlines.js on lines 76..80

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 49.

        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 {
                            // Otherwise, just insert the remove button as the
                            // last child element of the form's container:
                            row.children(":first").append('<span><a class="' + options.deleteCssClass + '" href="#">' + options.deleteText + "</a></span>");
                        }
        Severity: Minor
        Found in pro1/staticfiles/admin/js/inlines.js and 1 other location - About 40 mins to fix
        pro1/staticfiles/admin/js/inlines.js on lines 68..72

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

        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