burningpony/phd_checker

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

Summary

Maintainability
F
3 days
Test Coverage

File phd.js has 504 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const PHASE_ONE_ID = 1;
const PHASE_TWO_ID = 2;
var TIME_LIMIT_IN_MINUTES = 7;
var INTERVAL_IN_SECONDS_OF_HOW_OFTEN_TO_SHOW_OTHER_STUDENT_ACTIONS = 60; // one minute
var TIMEOUT_FOR_OTHER_PARTICIPANTS = 15 * 1000;
Severity: Major
Found in app/assets/javascripts/phd.js - About 1 day to fix

    Function generate_box has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function generate_box(span) {
                var is_quota = span.className.match(/quota/i) != null
                    ? true
                    : false;
                if (is_quota && window.__show_quota_items) {
    Severity: Major
    Found in app/assets/javascripts/phd.js - About 3 hrs to fix

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

              window.show_instructions = function() {
                  var timer_started = false;
                  $(".round").html("Round " + window.round_number);
                  reset_essay_links();
                  $(".round").html("Round " + window.round_number);
      Severity: Minor
      Found in app/assets/javascripts/phd.js - About 1 hr to fix

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

                    onShow: function(dialog) {
                        var modal = this;
                        $(".participant").show();
                        //accept enter
                        $(".participant input").keyup(function(event) {
        Severity: Minor
        Found in app/assets/javascripts/phd.js - About 1 hr to fix

          Function finished_modal has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  window.finished_modal = function finished_modal() {
                      // basically 'callLater' something about these dialogs
                      setTimeout(function() {
                          $(".finished").modal({
                              close: false,
          Severity: Minor
          Found in app/assets/javascripts/phd.js - About 1 hr to fix

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

                        input.state = function() {
                            /*
                            Given a span like:
                            <span class='correctme' rel='correct string'>original string</span>
            
            
            Severity: Minor
            Found in app/assets/javascripts/phd.js - About 1 hr to fix

              Function show_other_student_actions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      window.show_other_student_actions = function() {
                          // stops the timer and shows what other students are up to
                          // basically overlays a model dialog and we work from there
                          window.stop_timer();
                          // make sure whatever is open is now closed
              Severity: Minor
              Found in app/assets/javascripts/phd.js - About 1 hr to fix

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

                        window.score_card_modal = function score_card_modal() {
                            // basically 'callLater' something about these dialogs
                            setTimeout(function() {
                                $(".score_card").modal({
                                    close: false,
                Severity: Minor
                Found in app/assets/javascripts/phd.js - About 1 hr to fix

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

                          window.start_timer = function() {
                              window.stop_timer();
                              timer = setInterval(function() {
                                  var minutes_to_render =
                                      TIME_LIMIT_IN_MINUTES - parseInt(seconds / 60) - 1;
                  Severity: Minor
                  Found in app/assets/javascripts/phd.js - About 1 hr to fix

                    Function quit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            window.quit = function(kwargs) {
                                // make sure whatever is open is now closed
                                $.modal.close();
                                if (kwargs && kwargs.timeout) {
                                    //MAKE IT SO WHEN IT TIMES OUT IT CHECKS WHAT ROUND IT IS ON AND DOES THE RIghT ThinG
                    Severity: Minor
                    Found in app/assets/javascripts/phd.js - About 1 hr to fix

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

                                                  {
                                                      user_id: window.user.id,
                                                      round_number: window.round_number,
                                                      round_time: window.elapsed_time_in_seconds,
                                                      completed_in_time: window.completed_in_time,
                      Severity: Major
                      Found in app/assets/javascripts/phd.js and 1 other location - About 1 hr to fix
                      app/assets/javascripts/phd.js on lines 264..271

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

                      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

                                                  {
                                                      user_id: window.user.id,
                                                      round_number: window.round_number,
                                                      round_time: window.elapsed_time_in_seconds,
                                                      completed_in_time: window.completed_in_time,
                      Severity: Major
                      Found in app/assets/javascripts/phd.js and 1 other location - About 1 hr to fix
                      app/assets/javascripts/phd.js on lines 223..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 64.

                      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 (!timer_started) {
                                                  window.start_timer();
                                                  timer_started = true;
                                                  $(".content").show();
                                                  // click on first essay
                      Severity: Minor
                      Found in app/assets/javascripts/phd.js and 1 other location - About 55 mins to fix
                      app/assets/javascripts/phd.js on lines 128..134

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

                      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 (!timer_started) {
                                              window.start_timer();
                                              timer_started = true;
                                              $(".content").show();
                                              // click on first essay
                      Severity: Minor
                      Found in app/assets/javascripts/phd.js and 1 other location - About 55 mins to fix
                      app/assets/javascripts/phd.js on lines 140..146

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

                      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