pivotal/projectmonitor

View on GitHub
app/assets/javascripts/projectEdit.js

Summary

Maintainability
C
1 day
Test Coverage

Function validateTrackerSetup has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  o.validateTrackerSetup = function () {
    var authToken = $('input#project_tracker_auth_token').val();
    var projectId = $('input#project_tracker_project_id').val();

    clearTrackerSetupValidations();
Severity: Major
Found in app/assets/javascripts/projectEdit.js - About 2 hrs to fix

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

      o.validateFeedUrl = function () {
        $('.success, .failure, .unconfigured, .empty_fields', '#polling').addClass('hide');
    
        if ($('#project_type').val() === "") {
          $('#build_status .unconfigured').removeClass('hide');
    Severity: Minor
    Found in app/assets/javascripts/projectEdit.js - About 1 hr to fix

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

        var humanReadableErrorHTML = function(error) {
          var string = "";
          var error_text = error.error_text;
          var project_type = $("#project_type").val();
          var url = "";
      Severity: Minor
      Found in app/assets/javascripts/projectEdit.js - About 1 hr to fix

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

              if (error_text.indexOf("404") > -1) {
                url = error_text.match(/Got 404 response status from ([\w:\/.?=]+),/)[1];
                string += "<p>Error 404: Could not find a project with the specified information</p> <p>URL: " + url + "</p>";
              }
        Severity: Major
        Found in app/assets/javascripts/projectEdit.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/projectEdit.js on lines 158..161

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

        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 (error_text.indexOf("404") > -1) {
                url = error_text.match(/Got 404 response status from ([\w:\/.?=]+),/)[1];
                string += "<p>Error 404: Could not find a project with the specified information</p> <p>URL: " + url + "</p>";
              }
        Severity: Major
        Found in app/assets/javascripts/projectEdit.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/projectEdit.js on lines 145..148

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

        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 showAuthTokenError = function () {
            $('#project_tracker_auth_token_status .failure').removeClass('hide');
            $('#tracker_status .failure').removeClass('hide').text("Error in auth token");
          };
        Severity: Minor
        Found in app/assets/javascripts/projectEdit.js and 1 other location - About 45 mins to fix
        app/assets/javascripts/projectEdit.js on lines 14..17

        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

          var showProjectIdError = function () {
            $('#project_tracker_project_id_status .failure').removeClass('hide');
            $('#tracker_status .failure').removeClass('hide').text("Error in project ID");
          };
        Severity: Minor
        Found in app/assets/javascripts/projectEdit.js and 1 other location - About 45 mins to fix
        app/assets/javascripts/projectEdit.js on lines 9..12

        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 ($('input#project_webhooks_enabled_false:checked').length > 0) {
              $('#field_container').removeClass('hide');
              $('#webhook_url').addClass('hide');
              $('fieldset#polling').removeClass('hide');
            }
        Severity: Minor
        Found in app/assets/javascripts/projectEdit.js and 1 other location - About 40 mins to fix
        app/assets/javascripts/projectEdit.js on lines 200..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 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

                if (result.status) {
                  $('#polling .pending').addClass('hide');
                  $('#build_status .success').removeClass('hide');
                  $('.error-message').addClass('hide');
                }
        Severity: Minor
        Found in app/assets/javascripts/projectEdit.js and 1 other location - About 40 mins to fix
        app/assets/javascripts/projectEdit.js on lines 238..242

        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