burningpony/phd_checker

View on GitHub

Showing 103 of 103 total issues

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

            o[os[i].rows[0]] = { text: o[os[i].rows[0]], row: ns[i].rows[0] };
Severity: Major
Found in app/assets/javascripts/diff.js and 1 other location - About 1 hr to fix
app/assets/javascripts/diff.js on lines 166..166

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

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

Function close has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        close: function() {
            var s = this;

            // prevent close when dialog does not exist
            if (!s.d.data) {
Severity: Minor
Found in app/assets/javascripts/simple_modal.js - About 1 hr to fix

    Function _finish has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _finish = function () {
                if (!$.support.opacity) {
                    content.get(0).style.removeAttribute('filter');
                    wrap.get(0).style.removeAttribute('filter');
                }
    Severity: Minor
    Found in public/fancybox/jquery.fancybox-1.3.4.js - About 1 hr to fix

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

                  to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
      Severity: Major
      Found in public/fancybox/jquery.fancybox-1.3.4.js and 1 other location - About 1 hr to fix
      public/fancybox/jquery.fancybox-1.3.4.js on lines 722..722

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

      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

                  to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
      Severity: Major
      Found in public/fancybox/jquery.fancybox-1.3.4.js and 1 other location - About 1 hr to fix
      public/fancybox/jquery.fancybox-1.3.4.js on lines 721..721

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

      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

      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

        Method analyzed_available_payments has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def analyzed_available_payments
            @analyzed_available_payments ||= {}
            Job.all.each do |job|
              Payment.all.each do |payment|
                if available_payments.present? && available_payments.is_a?(Hash) && available_payments[job]
        Severity: Minor
        Found in app/models/user.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function send_correction has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            group_id,
            participant_id,
            essay_id,
            field_id,
            original_value,
        Severity: Major
        Found in app/assets/javascripts/save_functions.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 _formatTime has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _formatTime: function(time, format, ampm) {
                        if (ampm == undefined) ampm = this._defaults.ampm;
                        time = time || { hour: this.hour, minute: this.minute, second: this.second, ampm: this.ampm };
                        var tmptime = format || this._defaults.timeFormat.toString();
                
                
                Severity: Minor
                Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 1 hr to fix

                  Function fancybox has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      $.fancybox = function(obj) {
                          var opts;
                  
                          if (busy) {
                              return;
                  Severity: Minor
                  Found in public/fancybox/jquery.fancybox-1.3.4.js - About 1 hr to fix

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

                        _parseTime: function(timeString, withDate) {
                            var regstr = this._defaults.timeFormat.toString()
                                    .replace(/h{1,2}/ig, '(\\d?\\d)')
                                    .replace(/m{1,2}/ig, '(\\d?\\d)')
                                    .replace(/s{1,2}/ig, '(\\d?\\d)')
                    Severity: Minor
                    Found in lib/assets/javascripts/jquery-ui-timepicker-addon.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

                        Function fancybox has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            $.fn.fancybox = function(options) {
                                if (!$(this).length) {
                                    return this;
                                }
                        
                        Severity: Minor
                        Found in public/fancybox/jquery.fancybox-1.3.4.js - About 1 hr to fix

                          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

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

                                      if ($.isFunction(s.o.onHide)) {
                                          s.o.onHide.apply(s, [s.d]);
                                      }
                          Severity: Minor
                          Found in app/assets/javascripts/simple_modal.js and 1 other location - About 55 mins to fix
                          app/assets/javascripts/simple_modal.js on lines 297..299

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

                          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 ($.isFunction(s.o.onShow)) {
                                          s.o.onShow.apply(s, [s.d]);
                                      }
                          Severity: Minor
                          Found in app/assets/javascripts/simple_modal.js and 1 other location - About 55 mins to fix
                          app/assets/javascripts/simple_modal.js on lines 844..846

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

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language