burningpony/phd_checker

View on GitHub

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

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

                if ((currentArray.length -1) > currentIndex) {
                    href = currentArray[ currentIndex + 1 ].href;
    
                    if (typeof href !== 'undefined' && href.match(imgRegExp)) {
                        objNext = new Image();
    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 642..649

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

    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 (currentIndex > 0) {
                    href = currentArray[ currentIndex - 1 ].href;
    
                    if (typeof href !== 'undefined' && href.match(imgRegExp)) {
                        objNext = new Image();
    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 633..640

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

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

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

                            if ((to.width ) > view[0]) {
                                to.width = view[0];
                                to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 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 710..713

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

        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 ((to.height) > view[1]) {
                                to.height = view[1];
                                to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 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 705..708

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

        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

        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

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

                            'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
            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 1031..1031

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

            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

                            'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
            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 1030..1030

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

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

                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

                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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language