burningpony/phd_checker

View on GitHub

Showing 50 of 103 total issues

Function _newInst has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _newInst: function($input, o) {
        var tp_inst = new Timepicker(),
            inlineSettings = {};

        for (var attrName in this._defaults) {
Severity: Minor
Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 1 hr to fix

    Function diffString2 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function diffString2(o, n) {
        o = o.replace(/\s+$/, "");
        n = n.replace(/\s+$/, "");
    
        var out = diff(
    Severity: Minor
    Found in app/assets/javascripts/diff.js - 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 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    window.send_correction = function(
        group_id,
        participant_id,
        essay_id,
        field_id,
    Severity: Minor
    Found in app/assets/javascripts/save_functions.js - About 1 hr 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

        Method raw_csv has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.raw_csv(responses)
            CSV.generate do |csv|
              # header row
              csv << [
                'id',
        Severity: Minor
        Found in app/models/response.rb - About 1 hr to fix

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

                  init: function(data, options) {
                      var s = this;
          
                      // don't allow multiple calls
                      if (s.d.data) {
          Severity: Minor
          Found in app/assets/javascripts/simple_modal.js - About 1 hr to fix

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

            function Timepicker() {
                this.regional = []; // Available regional settings, indexed by language code
                this.regional[''] = { // Default regional settings
                    currentText: 'Now',
                    closeText: 'Done',
            Severity: Minor
            Found in lib/assets/javascripts/jquery-ui-timepicker-addon.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 bindEvents has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          bindEvents: function() {
                              var s = this;
                  
                              // bind the close event to any element with the closeClass class
                              $("." + s.o.closeClass).bind("click.simplemodal", function(e) {
                  Severity: Minor
                  Found in app/assets/javascripts/simple_modal.js - About 1 hr to fix

                    Function _get_zoom_to has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            _get_zoom_to = function () {
                                var view = _get_viewport(),
                                    to = {},
                                    resize = currentOpts.autoScale,
                                    double_padding = currentOpts.padding * 2,
                    Severity: Minor
                    Found in public/fancybox/jquery.fancybox-1.3.4.js - About 1 hr to fix

                      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

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

                              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 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 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language