hrzlvn/coursequestionbank

View on GitHub

Showing 53 of 53 total issues

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

                var showCorrect = function (showButton) {
                    $(this).parent().find(".entrybox").each(function () {
                        if ($(this).attr('correct') === 'true'){
                            $(this).find('.entryexplain').show();
                            $(this).find('input[type = "checkbox"]').prop("checked", true);
Severity: Major
Found in app/assets/javascripts/problem_more.js and 1 other location - About 1 day to fix
app/assets/javascripts/problem_more.js on lines 87..104

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

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

                var showCorrect = function (showButton) {
                    $(this).parent().find(".entrybox").each(function () {
                        if ($(this).attr('correct') === 'true'){
                            $(this).find('.entryexplain').show();
                            $(this).find('input[type = "checkbox"]').prop("checked", true);
Severity: Major
Found in app/assets/javascripts/problem_more.js and 1 other location - About 1 day to fix
app/assets/javascripts/problem_more.js on lines 186..203

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

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 setup has 221 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    setup: function() {
        $('.select_multiple_question').each(function() {
            var question = $(this);
            question.ready(function() {
                var hoverOnEntry = function() {
Severity: Major
Found in app/assets/javascripts/problem_more.js - About 1 day to fix

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

                        }else{
                            $(this).parent().find(".entrybox").css('border', '2px solid red');
                            $(this).parent().find(".fillin-correct").hide()
                            $(this).parent().find(".fillin-wrong").show()
                            $(this).parent().find(".fillin-showAnswer").hide()
    Severity: Major
    Found in app/assets/javascripts/problem_more.js and 1 other location - About 5 hrs to fix
    app/assets/javascripts/problem_more.js on lines 231..238

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

    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 ($(this).parent().find(".students-answer").val().toUpperCase() === $(this).parent().find("p.answer").text().trim().toUpperCase()){
                            $(this).parent().find(".entrybox").css('border', '2px solid green');
                            $(this).parent().find(".fillin-correct").show()
                            $(this).parent().find(".fillin-wrong").hide()
                            $(this).parent().find(".fillin-showAnswer").hide()
    Severity: Major
    Found in app/assets/javascripts/problem_more.js and 1 other location - About 5 hrs to fix
    app/assets/javascripts/problem_more.js on lines 238..245

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

    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 setup has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setup: function() {
        $('.additional').each(function() {
          var problem = $(this);
          
          function toggle_behavior(button_name){
    Severity: Major
    Found in app/assets/javascripts/problems.js - About 2 hrs to fix

      Function firstGraph has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var firstGraph = function (divId, success_rate) {
          var gaugeOptions = {
              chart: {
                  type: 'solidgauge'
              },
      Severity: Major
      Found in app/assets/javascripts/charts.js - About 2 hrs to fix

        File problem_more.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        
        var Question = {
            setup: function() {
                $('.select_multiple_question').each(function() {
                    var question = $(this);
        Severity: Minor
        Found in app/assets/javascripts/problem_more.js - About 2 hrs to fix

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

                          success: function(data, textStatus, jqXHR) {
                              if (data.error === null)
                                  window.location.reload();
                              else
                                  $(this).find('.message').text(data.error);
          Severity: Major
          Found in app/assets/javascripts/Supersession.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/MinorUpdate.js on lines 9..14

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

          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

                          success: function(data, textStatus, jqXHR) {
                              if (data.error === null)
                                  window.location.reload();
                              else
                                  $(this).find('.message').text(data.error);
          Severity: Major
          Found in app/assets/javascripts/MinorUpdate.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/Supersession.js on lines 9..14

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

          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 entrysGraph has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var entrysGraph = function(divId, entryChoice) {
              yData = [];
              for (i = 0; i < entryChoice.length; ++i) {
                  yData.push({name: "Entry " + (i + 1), data: [parseInt(entryChoice[i].trim())]});
              }
          Severity: Minor
          Found in app/assets/javascripts/charts.js - About 1 hr to fix

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

            var totalGraph = function(divId, overallAttempts, wrong_cnt) {
                Highcharts.chart(divId, {
                    chart: {
                        type: 'bar'
                    },
            Severity: Minor
            Found in app/assets/javascripts/charts.js - About 1 hr to fix

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

                              var checkCorrect = function(checkButton) {
                                  var correct = true
                                  var attemptRecord = ""
                                  $(this).parent().find(".entrybox").each(function () {
                                      // debugger
              Severity: Minor
              Found in app/assets/javascripts/problem_more.js - About 1 hr to fix

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

                var totalGraph = function(divId, overallAttempts, wrong_cnt) {
                    Highcharts.chart(divId, {
                        chart: {
                            type: 'bar'
                        },
                Severity: Minor
                Found in app/assets/javascripts/charts.js - About 1 hr to fix

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

                    def self.store_as_json(user, file)
                      filename = file.path
                      Quiz.reset
                      Quiz.instance_eval "#{IO.read(filename)}"
                      collections = []
                  Severity: Minor
                  Found in app/models/ruql_reader.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 setup has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    setup: function() {
                      $('.bloom-buttons').each(function() {
                        var container = $(this);
                        container.find('form').submit(function() {
                          $.ajax({
                  Severity: Minor
                  Found in app/assets/javascripts/changeBloom.js - About 1 hr to fix

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

                                            if ($(this).find('input[type="checkbox"]').is(':checked')){
                                                $(this).find('.entryexplain').show();
                                                $(this).off("mouseover");
                                                $(this).off("mouseleave");
                                            }else{
                    Severity: Major
                    Found in app/assets/javascripts/problem_more.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/problem_more.js on lines 160..172

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

                    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 ($(this).find('input[type="radio"]').is(':checked')){
                                                $(this).find('.entryexplain').show();
                                                $(this).off("mouseover");
                                                $(this).off("mouseleave");
                                                if ($(this).attr('correct') === 'true')
                    Severity: Major
                    Found in app/assets/javascripts/problem_more.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/problem_more.js on lines 56..64

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

                    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 5 locations. Consider refactoring.
                    Open

                            $.ajax({
                              url: $(this).attr('action'),
                              type: 'PUT',
                              data: $(this).serialize()
                            });
                    Severity: Major
                    Found in app/assets/javascripts/changeBloom.js and 4 other locations - About 45 mins to fix
                    app/assets/javascripts/SetObsolete.js on lines 4..8
                    app/assets/javascripts/changeCollection.js on lines 6..10
                    app/assets/javascripts/changePrivacy.js on lines 18..22
                    app/assets/javascripts/removeTag.js on lines 5..9

                    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 5 locations. Consider refactoring.
                    Open

                          $.ajax({
                            url: $(this).attr('action'),
                            type: 'POST',
                            data: $(this).serialize()
                          });
                    Severity: Major
                    Found in app/assets/javascripts/removeTag.js and 4 other locations - About 45 mins to fix
                    app/assets/javascripts/SetObsolete.js on lines 4..8
                    app/assets/javascripts/changeBloom.js on lines 7..11
                    app/assets/javascripts/changeCollection.js on lines 6..10
                    app/assets/javascripts/changePrivacy.js on lines 18..22

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language